我在"中做了一场赛跑游戏。 http://www.andengine.org/" rel="nofollow" >andengine 。 汽车由 Move Modicer () 移动。 汽车同时是动态的。 但是汽车移动时的动态布迪特征正在丢失 。
(敌人1=汽车)
Sprite enemy1=new Sprite(0,0,this.enemyRegion1);
enemy1.registerEntityModifier(
(IEntityModifier) new SequenceEntityModifier (
new MoveModifier(10, enemy1.getX(), enemy1.getX()+400,
enemy1.getY(), enemy1.getY())));
final Vector2 velocity = Vector2Pool.obtain(5, 5);
final FixtureDef enemyFixtureDef1 = PhysicsFactory.createFixtureDef(0, 0, 0);
this.enemyBody1 = PhysicsFactory.createBoxBody(this.mPhysicsWorld, enemy1, BodyType.DynamicBody, enemyFixtureDef1);
this.enemyBody1.setLinearVelocity(velocity);
Vector2Pool.recycle(velocity);
this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(enemy1, this.enemyBody1, true, false));
this.scene.attachChild(enemy1);