Hi, I hope you guys can help me as fast as you did last time, I really appreciated it.
I am using the Sydney md2 model in my program, and although setting the animation outside the game loop (in main) will play that animation (like EMAT_RUN) when I want to change the animation in the device run loop along with a button pressed, the animation is stuck on the first frame of the new animation (probably because it keeps calling a reset of the animation on each loop).
How would I go about switching between the EMAT_RUN and EMAT_STAND animations on key strokes?
Changing animations during the game loop
Re: Changing animations during the game loop
Ok, I've tried to set flags to keep track of which ones are already playing, but so many flags just become a huge mess, can someone please show me how they make one character do different animations on the click of a button?
Re: Changing animations during the game loop
You could just have an enum and set it to the current animation. You could even throw that into a struct or class to keep one per animated object.
Re: Changing animations during the game loop
Thanks, I'll look into that, but could you expand on how this would work?
* Ok, now I've learnt a new thing, enums, thanks! It works now. I'll just put this here for someone who finds this thread:
It seems an enum is a variable you can set, like any, but instead of 1 ,3789, 29 or a, d, or any other letter, you give the variables it can be names. Like in my case I have an enum I called Animation. Animation can be set to RUN, WALK, STAND or HIT, and so if I want to switch to one animation or another, I just check if animation is the one I want to set it to, and then ignore if it's already on that animation. This stopped me from using a boolean flag for each animation state.
* Ok, now I've learnt a new thing, enums, thanks! It works now. I'll just put this here for someone who finds this thread:
It seems an enum is a variable you can set, like any, but instead of 1 ,3789, 29 or a, d, or any other letter, you give the variables it can be names. Like in my case I have an enum I called Animation. Animation can be set to RUN, WALK, STAND or HIT, and so if I want to switch to one animation or another, I just check if animation is the one I want to set it to, and then ignore if it's already on that animation. This stopped me from using a boolean flag for each animation state.