Blaze-Brigade
Static Public Member Functions | List of all members
View.Animation Class Reference

Static class containing all animation methods More...

Static Public Member Functions

static void attackAnimation (Direction direction, Unit unit)
 
static void animateUnitPosition (Graph graph, Unit unit, Node node)
 
static void animate (Direction direction, Unit unit)
 

Detailed Description

Static class containing all animation methods

Member Function Documentation

§ animate()

static void View.Animation.animate ( Direction  direction,
Unit  unit 
)
static

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
    directionThe direction the unit is moving in.

§ animateUnitPosition()

static void View.Animation.animateUnitPosition ( Graph  graph,
Unit  unit,
Node  node 
)
static

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
    graphThe graph of the game map.
    unitThe unit to be animated.
    nodeThe node to move to.

§ attackAnimation()

static void View.Animation.attackAnimation ( Direction  direction,
Unit  unit 
)
static

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
    directionThe direction of the attack - it can be Up, Down, Left, or Right.
    unitThe unit to be animated.

The documentation for this class was generated from the following file: