Soldier march

Talk about making games.

Soldier march

Postby savvy » Wed Jun 10, 2009 11:40 am

games controls are:
up-jump
down-duck
left & right to move
space-shoot

'how can i get he enemies to die after a certain amount of shots?
Attachments
soldier.zip
(857.14 KiB) Downloaded 168 times
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: Soldier march

Postby DST » Wed Jun 10, 2009 12:26 pm

Make an integer variable, actor variable, named health;

enemy>collision>any side>shot>
Code: Select all
health-=1;
if(health<=0){  //if damage can be more than one, then health can go from 1 to negative numbers,
                       //so we use <= 0 instead of ==0.
DestroyActor("Event Actor");
}


Also, your direction for your shots is changing with player direction; make sure the shots only set their direction on CreateActor, and never again after that.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Soldier march

Postby Bee-Ant » Thu Jun 11, 2009 4:41 am

DST wrote:
Code: Select all
health-=1;
if(health<=0){  //if damage can be more than one, then health can go from 1 to negative numbers,
                       //so we use <= 0 instead of ==0.
DestroyActor("Event Actor");
}

Through this way, your enemy would die when their HP is 1.

Use this instead...(if you want your enemy die when the HP is 0)
Code: Select all
if(health<=0){  //if damage can be more than one, then health can go from 1 to negative numbers,
                       //so we use <= 0 instead of ==0.
DestroyActor("Event Actor");
}
health-=1;
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Soldier march

Postby savvy » Fri Jun 12, 2009 11:54 am

Ok, ive posted the updated version now anyway.
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: Soldier march

Postby Grynde » Thu Jun 20, 2013 12:52 am

Would the enemy's initial health be set in the draw actor command?

Edit*
After I d/l Sgt. Sparky's demo (viewtopic.php?f=6&t=5397) I figured it out.
Playing a game is the voluntary attempt to overcome unnecessary obstacles.
-Bernard Suits
User avatar
Grynde
 
Posts: 21
Joined: Fri Apr 26, 2013 12:41 pm
Location: Virginia
Score: 1 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest