Animation

Description

The Animation class will contain an individual animation found in a sprite sheet. It will contain the animation through an array of rectangles that get cycled through. The AnimationManager will call the update method of this class to cycle through the different frames. When an animation is created, it uses the frame width and height to divide the sprite sheet and populate the rectangle array with the frames.

Relationships

Members

  • List<Texture2D> frames - a list of the frames
  • float frameDur - Float for the frame duration (in seconds)
  • float frameTimer - Float for the frame timer
  • int currentFrame - Int for the index of the current frame
  • int startFrame - Int for the index of the start loop frame

Methods

  • Update
    • Updates the timer and increments the current frame when the timer exceeds the frame duration
  • Reset
    • Resets the current frame and timer to zero
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License