Be a Supporter!

Pop Enemies, and end with 0 health

  • 262 Views
  • 4 Replies
New Topic Respond to this Topic
Dragonberry
Dragonberry
  • Member since: Aug. 2, 2007
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Pop Enemies, and end with 0 health 2009-02-17 11:30:09 Reply

Well, I need two things:
Random Enemy Occurences
Well, on the screen, I have like 3 or 4 little "bunkers", let's call them instances

bunker 1-4

. I want the enemy, let's call him instance

McCain

, to at random times, and from random bunkers, come out for let's say 5 seconds.

-and-

Ending The Game When Health Is 0
Well, basically, I need the game to end when the instance

Health

is 0. As for my health, I have it dropping at a base of 5 when the player gets shot.

Thank You in Advance

Dragonberry
Dragonberry
  • Member since: Aug. 2, 2007
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to Pop Enemies, and end with 0 health 2009-02-17 11:49:17 Reply

C'mon Glaiel, Super-Flash-Bros. I know you guys know this.

4urentertainment
4urentertainment
  • Member since: Aug. 1, 2008
  • Offline.
Forum Stats
Moderator
Level 13
Game Developer
Response to Pop Enemies, and end with 0 health 2009-02-17 11:55:13 Reply

For the health, a simple if statement would suffice

if(_root.health.text == 0){_root.gotoAndStop(5);}

and change five with wherever the lose frame is.

Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to Pop Enemies, and end with 0 health 2009-02-17 11:55:50 Reply

At 2/17/09 11:30 AM, Dragonberry wrote: Well, I need two things:
Random Enemy Occurences
Well, on the screen, I have like 3 or 4 little "bunkers", let's call them instances

bunker 1-4

. I want the enemy, let's call him instance

McCain

, to at random times, and from random bunkers, come out for let's say 5 seconds.
-and-

Ending The Game When Health Is 0
Well, basically, I need the game to end when the instance

Health

is 0. As for my health, I have it dropping at a base of 5 when the player gets shot.

Thank You in Advance

In terms of timing (5 seconds, random intervals):

AS: Timeout by Inglor
AS: Intervals by Inglor
Just set the interval until McCain appears using (eg) 5000+random(5000); (5-10 seconds) and the time until he disappears again as 5000 (5 seconds)

In terms of the bunker, create McCain at the entrance of _root["bunker"+(random(4)+1)];

In terms of health, if(Health<=0){GAMEOVER();}and create a function GAMEOVER to do whatever you want at endgame


- - Flash - Music - Images - -

BBS Signature
Dragonberry
Dragonberry
  • Member since: Aug. 2, 2007
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to Pop Enemies, and end with 0 health 2009-02-17 11:56:11 Reply

At 2/17/09 11:55 AM, 4urentertainment wrote: For the health, a simple if statement would suffice

if(_root.health.text == 0){_root.gotoAndStop(5);}

and change five with wherever the lose frame is.

Thanks, I thought it might be something similar to that, now I just need to spawn enemies.