队列AndEngine多个实体修饰符 [英] Queue multiple entity modifiers in AndEngine
本文介绍了队列AndEngine多个实体修饰符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想有一个精灵(指针的)沿着两条路,一前一后。这里是我的code:
I'm trying to have a sprite ("pointer" below) along two paths, one after the other. Here is my code:
scene.attachChild(pointer);
pointer.clearEntityModifiers();
pointer.registerEntityModifier(new MoveModifier(
1.0f, 540, 960, 1000, 1000,
new IEntityModifierListener() {
public void onModifierStarted(IModifier<IEntity> pModifier, IEntity pItem) {}
public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
clickSound.play();
pointer.clearEntityModifiers();
pointer.registerEntityModifier(new MoveModifier(
1.0f, pointer.getX(), pointer.getY(), 500, 2500,
new IEntityModifierListener() {
public void onModifierStarted(IModifier<IEntity> pModifier, IEntity pItem) {}
public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
pointer.clearEntityModifiers();
pointer.detachSelf();
}
},
EaseCubicInOut.getInstance()
));
}
},
EaseCubicInOut.getInstance()
));
沿第一条路径的指针移动正如所料,然后clickSound播放,然后什么也没有发生。第二MoveModifier没有任何效果。我在做什么错在这里?
The pointer moves along the first path as expected, and then the clickSound plays, and then nothing happens. The second MoveModifier doesn't have any effect. What am I doing wrong here?
推荐答案
我不知道为什么你的code不工作,但我认为你可以使用实现同样的事情 SequenceEntityModifier
:
I'm not sure why your code is not working, but I think you can achieve the same thing using the SequenceEntityModifier
:
scene.attachChild(pointer);
pointer.clearEntityModifiers();
pointer.registerEntityModifier(new SequenceEntityModifier(
new MoveModifier#1(...),
new MoveModifier#2(...)));
这篇关于队列AndEngine多个实体修饰符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文