Package controller

Class CollisionAwareEgoController


public class CollisionAwareEgoController extends EgoController
An EgoController which cannot move through obstacle objects (is collission aware). Only respects GameObjects that have the String 'obstacle' in their name.
  • Constructor Details

    • CollisionAwareEgoController

      public CollisionAwareEgoController(double egoRad)
      Parameters:
      egoRad - radius of ego object to be used.
    • CollisionAwareEgoController

      public CollisionAwareEgoController(double egoRad, File soundOnShot)
      Parameters:
      egoRad - radius of ego object to be used.
      soundOnShot - WAV file to be played on shot
  • Method Details

    • saveDynamicState

      public void saveDynamicState()
    • restoreDynamicState

      public void restoreDynamicState()
    • stopObject

      public boolean stopObject()
      Description copied from class: EgoController
      checks the position and respects level boundaries and own radius or width/height set on constructor.
      Overrides:
      stopObject in class EgoController
      Returns:
      true if the object reached the boundaries of the level, false otherwise
    • onSpace

      public void onSpace(KeyEvent e, GameObject ego)
      Description copied from class: EgoController
      behavior for shooting on key space
      Overrides:
      onSpace in class EgoController
      Parameters:
      e - KeyEvent of the space key
      ego - EgoObject instance (used to determine position of shot object's start)