how to get full animation with 1 button press?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
RizzleR
Posts: 15
Joined: Tue Jun 15, 2004 10:12 am

how to get full animation with 1 button press?

Post by RizzleR »

i'm using the following code

Code: Select all

if(KeyStates[EPA_ACTION_JUMP]) 
         
             { 
                if(State != EPS_JUMPING) 
                         { 
                           State = EPS_JUMPING; 
                           amNode->setMD2Animation(irr::scene::EMAT_JUMP); 
                         } 
			    

              }
EPA_ACTION_JUMP is mapped to spacebarkey
problem is i have to keep it pressed to play the whole animation
want it to get so that when i press the spacebar 1 time
it plays the animation 1 time

anybody got any clues?
Manakel

Post by Manakel »

In your event when spacebar is pressed , turn on a BOOLEAN like bPlayAnimation=true.

and in you rendering, say if bPlayAnimation=true , set animation...
and toggle of bPlayAnimation


Quick and dirty idea , maybe not the best
RizzleR
Posts: 15
Joined: Tue Jun 15, 2004 10:12 am

Post by RizzleR »

seeing the amount of buttons i'm using and how they are implemented
this solution probably isn't gonna work
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post by warui »

Maybe problem is elsewhere ? I checkd setMD2Animation() and it takes aniamtion parameters from model (start frame, end frame and speed) and sets valuse for setAnimationSpeed() and setFrameLoop(). Maybe on releasing spacebar you set new FrameLoop and causes the problem.
I added node->setMD2Animation(EMAT_JUMP); to "hallo world" tutorial and it works perfectly fine.
Tomasz Nowakowski
Openoko - www.openoko.pl
Post Reply