Making body (box2d) a sprite (andengine) in Android
Posted
by
Kadir
on Game Development
See other posts from Game Development
or by Kadir
Published on 2012-04-24T10:55:36Z
Indexed on
2013/06/25
22:30 UTC
Read the original article
Hit count: 414
I can't make body (box2d) a sprite (andengine) and at the same time apply MoveModifier to sprite which is body. If i can make just body, it works namely the sprites can collide. If I apply just MoveModifier to sprites, the sprites can move where i want. But I want to make body (they can collide) and apply MoveModifier (they can move where I want) at the same time. How can i do it? This my code just run MoveModifier not as body at the same time.
circles[i] = new Sprite(startX, startY, textRegCircle[i]);
body[i] = PhysicsFactory.createCircleBody(physicsWorld, circles[i], BodyType.DynamicBody, FIXTURE_DEF);
physicsWorld.registerPhysicsConnector(new PhysicsConnector(circles[i], body[i], true, true));
circles[i].registerEntityModifier(
(IEntityModifier) new SequenceEntityModifier (
new MoveModifier(10.0f, circles[i].getX(), circles[i].getX(),
circles[i].getY(),CAMERA_HEIGHT+64.0f)));
scene.getLastChild().attachChild(circles[i]);
scene.registerUpdateHandler(physicsWorld);
© Game Development or respective owner