How do I get my enemies to respawn once they go off screen?

Get help using Construct 2

Post » Sat Sep 17, 2016 6:28 pm

If you've ever played Mega Man, or a lot of the old NES games, if you went off screen, the enemies came back and you'd have to kill 'em again. Annoying, yet I would like something like this in my game.

Even if you haven't played a game like that, if you know how I could do this, I would appreciate the help!!! :mrgreen:
B
24
S
9
Posts: 112
Reputation: 2,010

Post » Sat Sep 17, 2016 9:48 pm

Aquanex2 wrote:If you've ever played Mega Man, or a lot of the old NES games, if you went off screen, the enemies came back and you'd have to kill 'em again. Annoying, yet I would like something like this in my game.

Even if you haven't played a game like that, if you know how I could do this, I would appreciate the help!!! :mrgreen:


This is what I would do. :mrgreen:

https://www.dropbox.com/s/eqcdubg4ivv8p ... .capx?dl=0

The enemy sprites are set to be destroyed once they go outside the layout, so please walk right to see more enemies spawning.

Once you reach the far right, the enemies won't spawn again, because a newly spawned enemy will be destroyed right after spawning (due to 'destroy when outside the layout behavior'..)
B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Tue Sep 20, 2016 12:57 am

Gmoney wrote:
Aquanex2 wrote:If you've ever played Mega Man, or a lot of the old NES games, if you went off screen, the enemies came back and you'd have to kill 'em again. Annoying, yet I would like something like this in my game.

Even if you haven't played a game like that, if you know how I could do this, I would appreciate the help!!! :mrgreen:


This is what I would do. :mrgreen:

https://www.dropbox.com/s/eqcdubg4ivv8p ... .capx?dl=0

The enemy sprites are set to be destroyed once they go outside the layout, so please walk right to see more enemies spawning.

Once you reach the far right, the enemies won't spawn again, because a newly spawned enemy will be destroyed right after spawning (due to 'destroy when outside the layout behavior'..)


Nice idea! I also saw that rex_rainbow made a revive behaviour. Haven't tried it yet, but would that work as well?
B
24
S
9
Posts: 112
Reputation: 2,010

Post » Tue Sep 20, 2016 1:37 am

Aquanex2 wrote:Nice idea! I also saw that rex_rainbow made a revive behaviour. Haven't tried it yet, but would that work as well?


I just tried rexrainbow's revive behavior, but encountered an error message after adding it to my enemy sprite from the example capx file I posted earlier.

I'm not sure why the error occurred, and eventually I couldn't proceed with the revive behavior.. but I feel the revive plug-in would be the best way to have enemies respawn once they're destroyed outside of the screen (and respawn from Player.X + 500 or so.)
B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Tue Sep 20, 2016 1:39 am

Gmoney wrote:
Aquanex2 wrote:Nice idea! I also saw that rex_rainbow made a revive behaviour. Haven't tried it yet, but would that work as well?


I just tried rexrainbow's revive behavior, but encountered an error message after adding it to my enemy sprite from the example capx file I posted earlier.

I'm not sure why the error occurred, and eventually I couldn't proceed with the revive behavior.. but I feel the revive plug-in would be the best way to have enemies respawn once they're destroyed outside of the screen (and respawn from Player.X + 500 or so.)

I'll try it, thanks! :)
B
24
S
9
Posts: 112
Reputation: 2,010

Post » Tue Sep 20, 2016 1:41 am

You're welcome, Aquanex2. :mrgreen:

Just in case the plugin doesn't work, please use the events from my example capx file that I posted earlier. That will do the job.
B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Tue Sep 20, 2016 1:48 am

Aquanex2 wrote:
Gmoney wrote:
Aquanex2 wrote:Nice idea! I also saw that rex_rainbow made a revive behaviour. Haven't tried it yet, but would that work as well?


I just tried rexrainbow's revive behavior, but encountered an error message after adding it to my enemy sprite from the example capx file I posted earlier.

I'm not sure why the error occurred, and eventually I couldn't proceed with the revive behavior.. but I feel the revive plug-in would be the best way to have enemies respawn once they're destroyed outside of the screen (and respawn from Player.X + 500 or so.)

I'll try it, thanks! :)

I'm not currently working on it right now, but I thought of an idea that could work.

I could set a variable for every enemy called StartX and StartY.
At the start of the layout, set the value of every enemy's StartX and StartY to their starting position.
And reset their position when they go off screen.
B
24
S
9
Posts: 112
Reputation: 2,010

Post » Tue Sep 20, 2016 2:03 am

Yes, that would be a brilliant way to control multiple spawns of enemies. :mrgreen:
B
11
S
6
G
15
Posts: 256
Reputation: 9,207


Return to How do I....?

Who is online

Users browsing this forum: DolyGamesCosmos and 17 guests