我想在给定的路径上移动一只兔子。然后我在右侧创建了一只兔子,胡萝卜在左右。我已经给出了路径,但是那只兔子自动移动,我使用了 pathmodifer。
final AnimatedSprite stayrabit = new AnimatedSprite(CAMERA_WIDTH - 58, 90,32,32, this.mrabitTextureRegion, this.getVertexBufferObjectManager()) {
final Path path = new Path(10).to(CAMERA_WIDTH - 58, 90).to(10, 90);
}
@Override
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
//this.setPosition(pSceneTouchEvent.getX() - this.getWidth() / 2, pSceneTouchEvent.getY() - this.getHeight() / 2);
PathModifier pathModifier = new PathModifier(20, path);
this.registerEntityModifier(pathModifier);
return true;
}