frame loop when shoot

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
fon3m
Posts: 32
Joined: Thu Sep 28, 2006 9:34 pm

frame loop when shoot

Post by fon3m »

I have question that when i press to shoot and it's equal to enemy, i want the enemy is change frameloop. and i try this

Code: Select all

//when shoot is equal to enemy
void enemy::shootEn()
{
      nodeEn1->setFrameLoop ( 50,1000 );
      nodeEn1->setAnimationSpeed(60); 
}
but when is equal, enemy is in loop 50 and didn't change frame(i use get frame function). What's wrong? and How to fix it?

Thank you.
fon3m
Posts: 32
Joined: Thu Sep 28, 2006 9:34 pm

Post by fon3m »

I have already know that question.
thank you :P
joshua1091
Posts: 23
Joined: Thu Aug 09, 2007 5:16 pm

having same problem...

Post by joshua1091 »

please tell me what the solution is..the same thing happens to me
torleif
Posts: 188
Joined: Mon Jun 30, 2008 4:53 am

Post by torleif »

My hack is to calculate the frames passed based on total time & frame rate. If it's passed the number, resort to a different animation

I get the feeling that it's the hardest and silliest way of animating a character
Jallenbah
Posts: 12
Joined: Thu Aug 14, 2008 12:10 pm
Location: Vector3df(20.6, 4, 19.2);

Post by Jallenbah »

Because you're setting the frame loop every rotation of the applications main loop, it's going back to frame 50.

Try doing

Code: Select all

void enemy::shootEn()
{
      if((nodeEn1->getFrameNr() < 50) || (nodeEn1->getFrameNr() >1000))
      {
            nodeEn1->setFrameLoop ( 50,1000 );
            nodeEn1->setAnimationSpeed(60);
      }
}
That way, it will only set that animation if its not already doing this. I've not tested it, but i think that should work.
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Post by kornwaretm »

watch your looping mode also
Post Reply