Weapon Upgrade?

Game Editor comments and discussion.

Weapon Upgrade?

Postby Qsmash » Sun Apr 26, 2009 7:34 pm

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
Image
User avatar
Qsmash
 
Posts: 23
Joined: Sun Sep 30, 2007 2:39 am
Score: 1 Give a positive score

Re: Weapon Upgrade?

Postby skydereign » Sun Apr 26, 2009 9:32 pm

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++;
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron