Page 1 of 1

Powerup Problem

PostPosted: Sat Nov 22, 2008 4:22 pm
by BloodRedDragon
Hi peeps. I'm making a game in which you can collect powerups to shoot at the enemy. I'm trying to find out how to script the action when a player picks up the power up and he is equipped with machine gun ammo and can shoot a limited amount of bullets.

Ive tried this but i dont know how to correct it:

Collision with powerup icon:
machinefireP1 = 50;

Key Down: (This is what i press to fire the machine gun)
if(machinefireP1 =>0);
CreateActor("ball", "ball", "(none)", "(none)", 0, 0, false);
machinefireP1 = machinefireP1 -1;

Pleez help

Re: Powerup Problem

PostPosted: Sat Nov 22, 2008 8:08 pm
by skydereign
This may not be what you meant, but you it should be: if(machinefireP1 >=0);
C does not take =>, if you want greater or equal to, it must be the other way.
I would set it just to >, because you don't want to fire when you have no ammo. Also, I believe you don't want to have the bullets fire all at the same time, so you should create a timer instead of create machine gun bullet. And add a timer event to create the bullet. This would slow the machine gun shot, and make it adjustable.

Re: Powerup Problem

PostPosted: Sat Nov 22, 2008 10:56 pm
by Killagram
While you're at it, try this:

Make all powerups only one actor. Give him an animation for each type of powerup.
Then on collision, switch the ANIMINDEX of the powerup actor.
i.e.
Collision with powerup:
Code: Select all
switch(collide.animindex)
{
case 0:
//powerup code here
break;
case 1:
//powerup code here
break;
}


The animindex corresponds to the order of the animations in the list of animations in actor control.

Now as you place powerups in editor mode, you can set the animation in actor control to the proper type and it will be that type in game mode. :D

Re: Powerup Problem

PostPosted: Fri Jan 09, 2009 8:49 pm
by BloodRedDragon
Cheers guyz. i feel a bit stupid now putting => instead of >=.
BTW i have like 0 points and i've been on this forum for a year. Nobody gives me any points. Should I make more posts?

Re: Powerup Problem

PostPosted: Fri Jan 09, 2009 10:59 pm
by mrgame
you get points for helping people not how long ya been here :). look at me. i never use to use the forum much for posting. and ive been here along time :) only just really started posting here so i will start helping peoples but i have barly any points at the moment.

Re: Powerup Problem

PostPosted: Sat Jan 10, 2009 5:37 am
by BlarghNRawr
dont know how i got my points lawl :P