NevenResnik wrote:When I press the SPACE key I fire a bullet. Now I made a powerup. If you collect the powerup you start shooting the missle we made instead of the bullet when you press SPACE
OK, we need variables here...
1. First, make a variable. Go to Script Editor from any event. Click "Variables" button on the bottom window. Type "level" on the Name textbox, click Add.
2. Player->Keydown->Space->ScriptEditor:
- Code: Select all
if(level<5)
{
CreateActor("Bullet","YourBulletAnimation","(none)","(none)",0,0,false);
}
if(level>=5)
{
CreateActor("Missile","YourMissileAnimation","(none)","(none)",0,0,false);
}
//in this case, we set the player can shoot missile if he got 5 powerups
3. Player->Collision->PowerUp->ScriptEditor:
- Code: Select all
level++;
Note: always use ScriptEditor on any event, because we can easily edit them
