Hi there, I'am working on a game and use a animation sprite to show up. This one has to be shown'n only when i pressed the button. When i press A the effect animation shows up nicely and has gone. Then i press A for the second time, There are played now maybe 10 frames instead of 64 and it hangs on maybe 10 frames.

Does anyone know how to fix this up ?

Thanks in advance!,

Regards,
3DGSDutch



My code:

Code:
action redshell ()
{
while(1){
	my.ambient = 100;
   my.flags |= BRIGHT;
   my.z = 50;
   my.tilt = camera.tilt;
   my.roll = camera.roll;
   my.pan = camera.pan;
   my.scale_x = 2;
   my.scale_y = 2;
   my.scale_z = 2;
   
   if (key_a){ fireredshell(); ent_create("shellred+64.tga",vector(0,0,50),fireredshell); i = 1;}

		wait(1);
	}
}



Code:
action fireredshell()
{
	my.frame = 0;
	while(i > 0){
		my.x = 1510.720;
		my.y = 1366.842;
		
		if (my.frame == 1){
	  	handle = media_loop("sounds/shell1.ogg",NULL,100);
  	}
  		//my.frame = i;
  		lols = my.frame;
	  	my.frame += 2 * time_step;
	  	
     if (my.frame >= 64) i=0;
    	wait(1);
    	}
	}