Game Development Reference
In-Depth Information
It seems that we have managed to capture our design pretty well—there is one more addi-
tional method in there— Animation::AddFrames() . This particular method is there
to ease our work when we create the animation. It takes a position, size, and a number of
frames, and it iterates from that position horizontally to add frames into the m_Frames
vector. It is essentially a shortcut we can use rather than putting in the frames one by one.
With the Animation structure done, we can now move on to Animator , which will
actually use the animations to animate our sprite. The first thing that the animator needs to
do is to be able to create and store animations for later use. Also, since animations are
time dependent, it needs to have an Animator::Update() method, which gets called
every frame with the delta time. And, last but not least, it needs a way to switch between
animations.
With this in mind, here is what our private data looks like:
Search WWH ::




Custom Search