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

0 favourites
  • 8 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • 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!!!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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!!! <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    This is what I would do. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    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'..)

  • > 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!!! <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    >

    This is what I would do. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    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?

  • 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.)

  • > 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!

  • You're welcome, Aquanex2.

    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.

  • >

    > > 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.

  • Yes, that would be a brilliant way to control multiple spawns of enemies.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)