Package playground

Class Level4


public class Level4 extends SpaceInvadersLevel
extends SpaceInvadersLevel with aliens that need two hits to be destroyed.
  • Hit aliens twice to kill them
  • they say AUA when not destroyed
  • Field Details

    • MAX_HITS

      public static final int MAX_HITS
      constant defining the number of shots needed to destroy an enemy
      See Also:
  • Constructor Details

    • Level4

      public Level4()
  • Method Details

    • getStartupMessage

      protected String getStartupMessage()
      Description copied from class: SpaceInvadersLevel
      simply returns the text that should be displayed at level start
      Overrides:
      getStartupMessage in class SpaceInvadersLevel
      Returns:
      a string that is displayed at start. Should be not longer than 30 characters.
    • actionIfEnemyIsHit

      void actionIfEnemyIsHit(GameObject e, GameObject shot)
      Description copied from class: SpaceInvadersLevel
      implements game behavior if an enemy object is hit by a players' shot. It creates an explosion effect, plays a sound and adds 200 points to the current score (and it removes the enemy object and the shot object).
      Overrides:
      actionIfEnemyIsHit in class SpaceInvadersLevel
      Parameters:
      e - enemy which was hit
      shot - the shot object that hit the enemy