”Wanted Animation”

The beta-crunch is on and this week our group have been totally focused on adding the last, important features to our game. But also cutting the features that we won’t be able to add in time for beta or final.

In our game the players avatar, the bat, has many different states that are all represented by a change of animation to the bat. Examples of these is: “flying” -the normal animation cycle of the bat flying without any powerup, “greenP” –the effect of the green powerup, the bat is covered in a green slime-like glow and “dashing” – the bat is inside a sparkly field that should indicate the amazing speed of the bat while dashing.

One of the things I’ve been working on this week is a collection of functions we call “wanted animation”. What this does is actually manage the different animation cycles of mainly the bat and change it according to some set rules of priority.

This basically means that instead of just switching animation for the bat when something happens, we actually, whenever an animation event happens, instead send a message to our wanted animation. The wanted animation then decides if that animation is applicable to the bat in that situation.

There is actually two reasons for this. First we don’t have to have the many animation switching events individually keep track of the many different rules and priorities that govern if the bat is able to go in to that state. And second we have a system to actually hold back the triggering of animation that might not be able to apply at the moment, but a bit later.

So, if the bat hits a green powerup that powerups animation is added to the wanted animation. In next update the engine will check if the current animation is matching the wanted animation. In this example let’s say it doesn’t. Then the current animation will change to what’s in the wanted animation. If some seconds later the player decides to do a dash while the green powerup is still active, the dash animation actually has higher priority than the powerup allowing the animation to be switched once again. But, if the short dash animation is finished before the green powerup has run out that animation would actually still be in the wanted animation so the bat would go from dashing to being “greenly” powered up.

For the future I also hope to make this system actually transition between the right frames within the animation cycles. So if the bat is on frame four in an animation cycle, the system should be able to start the upcoming animation on frame five to make it look really smooth. The “problemis that it actually already look pretty good so this will probably not be prioritized.

En kommentar

  1. Chair of Indefinite Studies · mars 16, 2015

    Hello there!

    It is a really interesting post you have made. Overall it is good and as a reader one get an overview of your work. The text is easy to read and understand in general.

    I would have liked the post to explain more in detail how this wanted animation function works, as it is one get a good overview and can think out their own way of how to make it work but not really how you made it. You did make it did you not? From the text I am not sure if this is just a well thought out way that the function should work or if it is how it actually works.

    The process of how things work, what it does and why is explained clearly. Why you want it to be in the code, since it makes it easier to read and to make it work. The code probably won’t be as long as it would otherwise. One thing that could have improved the explanation would be the actual code or pseudo-code to be able to see further how the code works. More image to show when the bat changes would also have been nice.

    I would say it is valuable information but not very useful. It is a good explanation of how one can deal with animations and switching between them, not really explaining how that works in detail but rather sets ones mind into a process of figuring out how one could do this if programming it in ones own project.

    I like the text and found it interesting so hope to see more of this.
    Good job!

    Gilla

Lämna en kommentar