Flash 8
ActionScript 2.0
Hi there
I am creating a helicopter game. There are four weapon carriers on the helicopter called “weapon_carrier1”, “weapon_carrier2”, “weapon_carrier3” and “weapon_carrier4”.
Players can choose:
- to fire the missile from tube 1 (Keycode: 49)
- to fire the missile from tube 2 (Keycode: 50)
- to fire the missile from tube 3 (Keycode: 51)
- to fire the missile from tube 4 (Keycode: 52)
(this design is for later use as I plan to allow players to attach different missiles and bombs)
When I press (49), the missile(a) is fired from tube 1. However, when I press (49) again, (a) disappeared and a new one is launched at tube 1. How can this problem be solved?
Here is the code on “weapon_carrier1” (i.e. tube 1):
onClipEvent (enterFrame) {
//motion
speed = 50
if (Key.isDown (49)) {
this.attachMovie(“missile1”,“missile1”,0)
this.missile1._x = 0
this.missile1._y = 0;
}
this.missile1._y -= speed
this.missile1.gotoAndStop(‘fly’);
}
I don’t want the player to fire missiles like mad because it is mad already as there are [COLOR=red]4[/COLOR] firing tubes on the helicopter!