shooting multiple bullets (AS3)
Hello everyone,
I'm trying to make my platform game character shoot a gun, my character and gun are one movieclip and the bullet is another. The bullet mc starts on a blank frame with a stop() function, when I press the space bar the bullet mc plays from frame 2 which is a motion tween of the bullet quickly moving across the page. I've set the bullet's y and x values relative to the character mc so that the bullet always comes from the gun.
My issue is that if I press the space bar a bullet will fly out of the gun (great!) but if I press the space bar again, the first bullet disappears and the bullet animation starts again. I want to be able to shoot a new bullet every time I press the space bar without effecting the bullets that have already been shot.
...
if(event.keyCode == Keyboard.SPACE)
{
bullet_right_mc.y = (ball_mc.y -38);
bullet_right_mc.x = (ball_mc.x + 253);
bullet_right_mc.gotoAndPlay("shoot");
}
...
Thanks
Ryan
|