Static class containing all animation methods
More...
Static class containing all animation methods
§ animate()
static void View.Animation.animate |
( |
Direction |
direction, |
|
|
Unit |
unit |
|
) |
| |
|
inlinestatic |
Animate sprite to "walk" in the specified direction. This is done by cycling through 3 frames. For each direction, there is a frame with right foot forward, one with both at neutral, and one with left forward. The "walking" animation is done by cycling through the 3 frames.
Exceptions:
- The unit passed in must be alive, otherwise nothing will be shown to screen.
- This function will not function properly if a direction other then Up, Down, Left or Right is given.
- Parameters
-
direction | The direction the unit is moving in. |
§ animateUnitPosition()
static void View.Animation.animateUnitPosition |
( |
Graph |
graph, |
|
|
Unit |
unit, |
|
|
Node |
node |
|
) |
| |
|
inlinestatic |
Animates unit movement from current unit location to future unit location. Unit moves through the inbetween nodes obtained from pathing algorith by first moving horizontally, then vertically. For horizontally, the unit will move right if the future position is greater in the x direction, otherwise it will move left. For vertical, the unit will move down if future y position is greater then current, otherwise it will move up. animate is called to animate the walking from node to node, and the direction parameter in that call is determined by which direction the unit is moving. A tracker is kept for walking sounds, which counts up by 1 each time and plays a walking sound everytime it reaches 5.
Exception:
- Thie function will only execute if the original and new location are different, otherwise nothing will happen.
- The function assumes that the the path between original location and new location is valid.
- Parameters
-
graph | The graph of the game map. |
unit | The unit to be animated. |
node | The node to move to. |
§ attackAnimation()
static void View.Animation.attackAnimation |
( |
Direction |
direction, |
|
|
Unit |
unit |
|
) |
| |
|
inlinestatic |
Animates attack of unit in specified direction. The animation consists of moving 10 pixels towards that direction, then moving back to original location. Upon execution, gameState isAnimating is set to true, and false after it is finished.
Exceptions:
- The unit passed in must be alive, otherwise nothing will be shown to screen.
- This function will not function properly if a direction other then Up, Down, Left or Right is given.
- Parameters
-
direction | The direction of the attack - it can be Up, Down, Left, or Right. |
unit | The unit to be animated. |
The documentation for this class was generated from the following file: