i've got a class (Mole.class, extends Sprite) for a game. In this class i implement onAreaTouched and onManagedUpdate:
Using java Syntax Highlighting
- @Override
- public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
- SmashTheMole.vScore += 1;
- SmashTheMole.delMoleInMap(pX, pY);
- detachSelf();
- return false;
- }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
Using java Syntax Highlighting
- @Override
- protected void onManagedUpdate(float pSecondsElapsed) {
- // TODO Auto-generated method stub
- super.onManagedUpdate(pSecondsElapsed);
- secOnMole += 2 * pSecondsElapsed;
- if (!isVisible() && secOnMole > 5) {
- setVisible(true);
- } else if (isVisible() && secOnMole > 7) {
- SmashTheMole.delMoleInMap(pX, pY);
- SmashTheMole.vLoses += 1;
- detachSelf();
- }
- }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
When i touch the mole, he disappears but the area continue managing the touch event...
And, if i allow the mole to escape, then i touch the area and it counts for my score...
Anyone can help me?
i had got resetPosition() instead of detachSelf() before, but i want to "destroy" the mole, not change him position.
clearUpdateHandlers() don't work for me and i don't know how to try now...
Thank you
