Page 1 of 1

Weapon Upgrade?

PostPosted: Sun Apr 26, 2009 7:34 pm
by Qsmash
Can anyone tell me how to make an upgrade for my side-scrolling space shooter? I have a lazer set to create actor and I can't get it to change to another.

Also, hi! :D

Re: Weapon Upgrade?

PostPosted: Sun Apr 26, 2009 9:32 pm
by skydereign
If I get what you are asking, you want your ship to change the create actor, effectively upgrading the weapon? To do this, you will need to use a variable. So add a variable in Global Code, by
Code: Select all
int weapon;


And upon the keydown event that creates the actor, make it a keydown event, script editor
Code: Select all
switch(weapon)
{
    case 0: // no weapon upgrades
    CreateActor("laser", "laser", "(none)", "(none)", 0, 0, false);
    break;
    case 1: // weapon upgrade 1
    CreateActor("laserV2", "laserV2", "(none)", "(none)", 0, 0, false);
    break;
}


So to upgrade your weapon, upon collision with the upgrade in the script editor.
Code: Select all
weapon++;