动画精灵不使用物理处理程序执行动画:
我正在使用AndEngine GLES2的AnalogOnScreenControl来移动精灵。精灵是一个人,因此为了显示腿部运动,我将其设为动画精灵:
final AnimatedSprite person = new AnimatedSprite(personX, personY,
this.mPersonTextureRegion, vertexBufferObjectManager);
person.setScaleCenterY(this.mPersonTextureRegion.getHeight());
person.setScale(2);
对于运动,我正在创建一个物理处理程序:
final PhysicsHandler physicsHandler = new PhysicsHandler(person);
person.registerUpdateHandler(physicsHandler);
scene.attachChild(person);
这是屏幕控制的代码:
final AnalogOnScreenControl analogOnScreenControl = new AnalogOnScreenControl(
0, CAMERA_HEIGHT
- this.mOnScreenControlBaseTextureRegion.getHeight(),
this.mCamera, this.mOnScreenControlBaseTextureRegion,
this.mOnScreenControlKnobTextureRegion, 0.1f, 200,
this.getVertexBufferObjectManager(),
new IAnalogOnScreenControlListener() {
@Override
public void onControlChange(
final BaseOnScreenControl pBaseOnScreenControl,
final float pValueX, final float pValueY) {
physicsHandler
.setVelocity(pValueX * 100, pValueY * 100);
person.animate(new long[] { 200, 200, 200 }, 3, 5,
false);
}
屏幕控制对动画精灵完美地工作,但是当我创建物理处理程序时它没有动画。但是当我不创建物理处理程序时它会动画。那么为什么当我创建物理处理程序时它没有动画呢?