Page 1 of 1

frame loop when shoot

Posted: Thu Jan 04, 2007 8:23 pm
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.

Posted: Thu Jan 04, 2007 8:47 pm
by fon3m
I have already know that question.
thank you :P

having same problem...

Posted: Sat Aug 23, 2008 5:27 am
by joshua1091
please tell me what the solution is..the same thing happens to me

Posted: Sat Aug 23, 2008 11:19 am
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

Posted: Sat Aug 23, 2008 4:25 pm
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.

Posted: Mon Aug 25, 2008 7:12 am
by kornwaretm
watch your looping mode also