Package controller
Class CollisionAwareEgoController
java.lang.Object
controller.ObjectController
controller.EgoController
controller.CollisionAwareEgoController
An EgoController which cannot move through obstacle objects (is collission aware). Only respects
GameObjects that have the String 'obstacle' in their name.
-
Constructor Summary
ConstructorDescriptionCollisionAwareEgoController
(double egoRad) CollisionAwareEgoController
(double egoRad, File soundOnShot) -
Method Summary
Modifier and TypeMethodDescriptionvoid
onSpace
(KeyEvent e, GameObject ego) behavior for shooting on key spacevoid
void
boolean
checks the position and respects level boundaries and own radius or width/height set on constructor.Methods inherited from class controller.EgoController
onDown, onLeft, onRight, onStop, onUp, updateObject
Methods inherited from class controller.ObjectController
applySpeedVector, getPlayground, getTimestep, getVX, getVY, getX, getY, setDummy, setObject, setPlayground, setVX, setVY, setX, setY
-
Constructor Details
-
CollisionAwareEgoController
public CollisionAwareEgoController(double egoRad) - Parameters:
egoRad
- radius of ego object to be used.
-
CollisionAwareEgoController
- 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 classEgoController
- Returns:
- true if the object reached the boundaries of the level, false otherwise
-
onSpace
Description copied from class:EgoController
behavior for shooting on key space- Overrides:
onSpace
in classEgoController
- Parameters:
e
- KeyEvent of the space keyego
- EgoObject instance (used to determine position of shot object's start)
-