/** * On touch remove top touched npc and create a death effect on the touched spot. Trigger * GameState.END if the last Demon or Human was killed * * @param touchX * @param touchY * @return enum value that shows if some game element was actually touched or not */ public TouchedElement onTouchEvent(float touchX, float touchY) { TouchedElement result = TouchedElement.NONE; if (mGameState == GameState.RUNNING) { Npc touchedNpc = mNpcContainer.removeTopTouchedNpc(touchX, touchY); if (touchedNpc != null) { boolean isDemon = touchedNpc.getNpcType().isEnemy(); updateScore(touchedNpc); // Create a new death effect at the location of the killed npc mDeathEffectContainer.createDeathEffect( touchedNpc.getCenterX(), touchedNpc.getCenterY(), isDemon); if (isDemon) { result = TouchedElement.DEMON; } else { result = TouchedElement.HUMAN; } } checkForGameEnd(); } return result; }