Hi,
I have a small problem when i use Physics with animation.
I made a small project to show:
When i use this code:
// create animation
auto animation = Animation::createWithSpriteFrames(frames, 0.1f);
auto animate = Animate::create(animation);
auto bomb = Sprite::create();
bomb->runAction(RepeatForever::create(animate));
bomb->setName("shoot");
bomb->setContentSize(Vec2(78, 64));
// setup the physical body
auto physicsBody = PhysicsBody::createCircle(bomb->getContentSize().width / 2, PhysicsMaterial(1.0f, 0.1f, 0.8f));
physicsBody->setMass(1.0f);
bomb->setPhysicsBody(physicsBody);
The bomb goes to:
But when i use this code:
auto bomb = Sprite::create( "bomb.png");
bomb->setName("shoot");
bomb->setContentSize(Vec2(78, 64));
// setup the physical body
auto physicsBody = PhysicsBody::createCircle(bomb->getContentSize().width / 2, PhysicsMaterial(1.0f, 0.1f, 0.8f));
physicsBody->setMass(1.0f);
bomb->setPhysicsBody(physicsBody);
The bomb goes to down, correctly.
Basically the problem is here:
sprite->runAction(RepeatForever::create(animate));
If i comment this line, it works.
Thanks.