Package controller
Class LimitedTimeController
java.lang.Object
controller.ObjectController
controller.LimitedTimeController
Controls and abject that is deleted after a lifetime specified in the constructor, and when it
leaves the display.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Is called once every game time step by the game itself.Methods inherited from class controller.ObjectController
applySpeedVector, getPlayground, getTimestep, getVX, getVY, getX, getY, setDummy, setObject, setPlayground, setVX, setVY, setX, setY
-
Constructor Details
-
LimitedTimeController
public LimitedTimeController(double g0, double duration) Constructor.- Parameters:
g0
- int initial game time at creationduration
- int duration in seconds
-
-
Method Details
-
updateObject
public void updateObject()Description copied from class:ObjectController
Is called once every game time step by the game itself. NEVER call this directly, not necessary!
The method can do whatever it likes, including nothing. The attributeObjectController.gameObject
contains a reference to the controlled object, which allows access to the Playground the object belongs to (useful for getting the pixel size in x and y of the playing field.
Recommended: when implementing this method, call at the endObjectController.applySpeedVector()
method. This is a helper method that sets the new x,y coordinates for theObjectController.gameObject
correctly.- Specified by:
updateObject
in classObjectController
-