AnimationManager

Description

The AnimationManager will maintain a list of animations that will be used for sprite sheets. The manager maintains a single sprite sheet and defines the width and height of the sheet. A manager will be created for any object that need its it.

Relationships

  • Player/Enemy : Created by an Enemy or Player
  • Animation : The AnimationManager creates Animation objects

Members

  • List<Animation> animation - A list that will contain the animations
  • List<string> animationName - A list that will hold the names of the animations that will correspond to the list of animations
  • string currentAnimation - String for the current animation
  • bool update - Boolean as an update state for the animation
  • int sheetWidth - Int for sprite sheet width
  • int frameWidth - Int for individual frame width
  • int frameHeight - Int for individual frame height

Methods

  • ToggleAnimationState
    • Changes the update state of the animation to the specified boolean parameter
  • AddAnimation
    • Creates a new animation object by passing the parameters:
      • String name
        • Name of the animation
      • Int startFrame
        • Index of the first frame in the sprite sheet
      • Int endFrame
        • Index of the last frame in the sprite sheet
      • Int startLoopFrame
        • Used to specify a frame where looping would continue from, instead of the first frame
    • Adds the animation object to the dictionary of animation
  • Update
    • Updates the current animation, calling update on that animation object
  • Draw
    • Draws the current animation frame
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License