Time for action - adding animation frames

  1. Add the AddFrame() method to the Sprite class:
    public void AddFrame(Rectangle frameRectangle)
    {
    frames.Add(frameRectangle);
    }
    

What just happened?

Adding a frame to the sprite's animation is as simple as adding the corresponding Rectangle to the frames list. When the animation is updated, the frame value will be compared to the number of entries in frames (via frames.Count) eliminating the need to store the number of animation frames as a separate value.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.45.92