Hi,
Im trying launch a new version of my game on android too:
But after update to last cocos2d-x version and compile on android, i got this error on image uploaded. I think that the image is cropped of something like this.
The problem is that it only happens on Android. I dont have this problem on mac, ios, etc.
Both player and coin class inherit from cocos2d::sprite.
My player code creation:
bool Player::init()
{
CCLOG("Player::init");
speed = 1.0f;
speedMax = 4.0f;
acceleration = 1.0f;
speedMin = -4.0f;
playerGoDown = false;
canMove = true;
width = 106;
height = 66;
spriteSheet = SpriteBatchNode::create("res/player.png");
initWithTexture(spriteSheet->getTexture(), Rect(0, 0, width, height));
spriteSheet->addChild(this, 0);
setTag(GameObjects::TAG_PLAYER);
// cria animação para cima
Animation *animationUpFrames = Animation::create();
animationUpFrames->setDelayPerUnit(0.05f);
Rect rectAnimationUp = Rect(0*width, 1*height, width, height);
SpriteFrame *frameUp = SpriteFrame::createWithTexture(spriteSheet->getTexture(), rectAnimationUp);
Rect rectAnimationUp2 = Rect(1*width, 1*height, width, height);
SpriteFrame *frameUp2 = SpriteFrame::createWithTexture(spriteSheet->getTexture(), rectAnimationUp2);
Rect rectAnimationUp3 = Rect(2*width, 1*height, width, height);
SpriteFrame *frameUp3 = SpriteFrame::createWithTexture(spriteSheet->getTexture(), rectAnimationUp3);
animationUpFrames->addSpriteFrame(frameUp);
animationUpFrames->addSpriteFrame(frameUp2);
animationUpFrames->addSpriteFrame(frameUp3);
animationUp = Animate::create(animationUpFrames);
animationUp = RepeatForever::create((Sequence*)animationUp);
CC_SAFE_RETAIN(animationUp);
...
The coin have the same problem:
bool Coin::init()
{
CCLOG("Coin::init");
width = 50;
height = 50;
speed = GameObjects::gameSpeed;
char imageName[128] = {0};
sprintf(imageName, "res/coins.png");
spriteSheet = SpriteBatchNode::create(imageName);
initWithTexture(spriteSheet->getTexture(), Rect(0, 0, width, height));
spriteSheet->addChild(this, 0);
setTag(GameObjects::TAG_COIN);
// cria animação
Animation *animationFrames = Animation::create();
animationFrames->setDelayPerUnit(0.08f);
int animationRectHeight = 0;
if (points == 50)
{
animationRectHeight = 0;
}
else if (points == 25)
{
animationRectHeight = 50;
}
else if (points == 10)
{
animationRectHeight = 100;
}
else if (points == 5)
{
animationRectHeight = 150;
}
else if (points == 2)
{
animationRectHeight = 200;
}
else if (points == 1)
{
animationRectHeight = 250;
}
for(int x = 0; x < 5; x++)
{
Rect rectAnimation = Rect(x*width, animationRectHeight, width, height);
SpriteFrame *frame = SpriteFrame::createWithTexture(spriteSheet->getTexture(), rectAnimation);
animationFrames->addSpriteFrame(frame);
}
animation = Animate::create(animationFrames);
animation = RepeatForever::create((Sequence*)animation);
CC_SAFE_RETAIN(animation);
stopAllActions();
runAction(animation);
setTag(GameObjects::TAG_COIN);
return true;
}
Can anyone help me please?