public class Hero
extends java.lang.Object
Constructor and Description |
---|
Hero(float x,
float y,
int controlType)
This constructor initializes a new instance of Hero at the appropriate
location and using the appropriate controlType.
|
Modifier and Type | Method and Description |
---|---|
Graphic |
getGraphic()
This is a simple accessor for this object's Graphic, which may be used
by other objects to check for collisions.
|
boolean |
handleFireballCollisions(java.util.ArrayList fireballs)
This method detects an handles collisions between any active Fireball
objects, and the current Hero.
|
void |
update(int time,
Water[] water)
This method is called repeated by the Level to draw and move (based on
the current controlType) the Hero, as well as to spray new Water in the
direction that this Hero is currently facing.
|
public Hero(float x, float y, int controlType)
x
- the x-coordinate of this new Hero's positiony
- the y-coordinate of this new Hero's positioncontrolType
- specifies which control scheme should be used by the
player to move this hero around: 1, 2, or 3.public void update(int time, Water[] water)
time
- is the amount of time in milliseconds that has elapsed since
the last time this update was called.water
- the array of Water that the Hero has sprayed in the past,
and if there is an empty (null) element in this array, they can can add
a new Water object to this array by pressing the appropriate controls.public Graphic getGraphic()
public boolean handleFireballCollisions(java.util.ArrayList fireballs)
fireballs
- the ArrayList of Fireballs that should be checked
against the current Hero's position for collisions.