// Touch panel event public boolean onTouchEvent(MotionEvent event) { // Press if (event.getAction() == MotionEvent.ACTION_DOWN) { switch (GameStateClass.currentState) { case op: GV.videoPlayer.Destroy(); break; case Menu: // Stop the video player if video is playing if (!GV.videoPlayer.isRuningVideo) { // Stop the game thread game.Exit(); // Play the flying video GV.videoPlayer.Load(R.raw.f16); GV.videoPlayer.Play(); } else { GV.videoPlayer.Destroy(); } break; case Stage1: // Bomb skill if (F16.bigBoom > 0) { if ((int) game.totalFrames - F16.startBigBoomFrame > F16.bigBoomDelayFrame) { F16.startBigBoomFrame = (int) game.totalFrames; F16.isTouchBoom = true; F16.bigBoom--; } } break; } } return super.onTouchEvent(event); }
// Pause the game @Override protected void onPause() { GV.vibrator.cancel(); wakeLock.release(); // Unregister the sensor sensorMgr.unregisterListener(lsn); // Pause the video if (GV.videoPlayer.isRuningVideo) GV.videoPlayer.Pause(); if (game != null) { // Pause the music if (GameStateClass.currentState != GameState.Menu) { if (GV.music != null) GV.music.Pause(); } // Stop the game game.Exit(); } super.onPause(); }