Beispiel #1
0
  public void sequenceEnded(String imageName)
        // called by ImagesPlayer when the explosion animation finishes
      {
    showExplosion = false;
    explosionPlayer.restartAt(0); // reset animation for next time

    if (numHits >= MAX_HITS) {
      gameOver = true;

      score = (int) ((System.nanoTime() - gameStartTime) / 1000000000L);
      clipsLoader.play("applause", false);
    }
  } // end of sequenceEnded()
Beispiel #2
0
  public void showExplosion(int x, int y)
        // called by fireball sprite when it hits jack at (x,y)
      {
    if (!showExplosion) { // only allow a single explosion at a time
      showExplosion = true;
      xExpl = x - explWidth / 2; // \ (x,y) is the center of the explosion
      yExpl = y - explHeight / 2;

      /* Play an explosion clip, but cycle through them.
      This adds variety, and gets round not being able to
      play multiple instances of a clip at the same time. */
      clipsLoader.play(exploNames[numHits % exploNames.length], false);
      numHits++;
    }
  } // end of showExplosion()