我是 Andengine 的新手。我已经检查了关于 stackoverflow 的所有删除精灵问题,但我的情况有点不同。我有两个动画精灵。我正在制作简单的动画错误,它正在移动。当玩家点击虫子时,血液会从中流出。所以我有两个动画精灵,虫子和血。
在虫子精灵的 onAreaTouched 中,我将血精灵附在其中。一切正常,但动画后我没有从中删除血精灵。
注意:我也检查过 onAnimationEnd 功能
请帮忙!谢谢
final AnimatedSprite bug= new AnimatedSprite(10, 10, 48, 64, this.mBugTextureRegion, this.getVertexBufferObjectManager()){
@Override
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
final AnimatedSprite blood= new AnimatedSprite(pSceneTouchEvent.getX(), pSceneTouchEvent.getY(), mBloodTextureRegion, this.getVertexBufferObjectManager());
//removing bug
scene.detachChild(this);
blood.setScale(2);
blood.animate(100, false);
scene.attachChild(blood);
//blood.dispose();
//this.dispose();
//this=null;
if(blood.getCurrentTileIndex() == 6){
runOnUpdateThread(new Runnable() {
@Override
public void run() {
//face.dispose();
//scene.unregisterTouchArea(blood);
scene.detachChild(blood);
}
});
}
return true;
}
};
04-16 21:44:10.440: D/AndEngine(6272): FPS: 57.68 (MIN: 9 ms | MAX: 33 ms)
04-16 21:44:11.361: I/ActivityManager(194): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.sonyericsson.home/.HomeActivity } from pid 194
04-16 21:44:11.371: D/AndEngine(6272): PathModifierExample.onPause @(Thread: 'main')
04-16 21:44:11.391: D/AndEngine(6272): PathModifierExample.onPauseGame @(Thread: 'main')
04-16 21:44:11.451: I/WindowManager(194): Setting rotation to 0, animFlags=1
04-16 21:44:11.451: I/ActivityManager(194): Config changed: { scale=1.0 imsi=410/6 loc=en_US touch=3 keys=1/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=133 themeResource=null}
04-16 21:44:11.631: W/IInputConnectionWrapper(6272): showStatusIcon on inactive InputConnection
04-16 21:44:11.822: I/ActivityManager(194): No longer want com.google.android.gm (pid 2712): hidden #16
04-16 21:44:11.852: W/SurfaceComposerClient(194): Destroying surface while a transaction is open. Client 0x1954c0: destroying surface 135, mTransactionOpen=1
04-16 21:44:13.944: D/dalvikvm(194): GC_EXPLICIT freed 246K, 44% free 6159K/10887K, external 5271K/6582K, paused 117ms