How do I make a enemy spawn manager?

0 favourites
  • 7 posts
From the Asset Store
Levels Manager
$9 USD
10% off
LevelsManager is a Construct 2 & 3 plugin to manage your worlds and levels easily
  • I am trying to make it where when a player hits a trigger enemies will spawn, but only as long as that enemy isn't already spawned. I am tying to set it up where I can have a set of events that will spawn my enemies, so i do not have to copy and past it all the time.

    I have already got it where the enemies will spawn when you hit the trigger, but they will keep spawning unless I give them each a global variable for it to check if they are alive. Every time I try to make it a instance variable they just wont spawn.

    Anyone have any ideas?

  • I think i could help, it doesn't seem to be such a complicated deal. However, could you please edit the post so i could better understand what you mean, and the problem you're having?

    For what i think you meant. maybe you could add a "object.count < 1" as a condition for spawning?

  • What I have is 3 different enemy types and I want to spawn them when I hit a trigger, but i want to spawn them on their spawn points I created. Also I want it where you can respawn them by hitting the trigger again while they are dead.

    I am able to get this to work, but I have some issues. One being that I want to re-use this code/function to spawn more enemies base on different triggers and different spawn points. i do not want to just copy and past it.

    Also how do I put a screen shot of what I have to show you what I been doing?

  • ok, so:

    1) on something in collision with trigger, while enemy.count = 0 ; then system creates object at coordinate. (this coordinate could be any object.x, object.Y, in case you want to move the spawner around)

    2) I wouldn't mind copying this line for different triggers/spawners. it's just 1 event anyway =)

    3) if windows 7, there's a tool for making images from screen. if not, press the print screen button i guess

  • What i have already is

    on collision-> call function(Spawn Manager)

    function(Spawn Manager)

    {

    system enemycounter=0

    {spritespawn: spawn another object: enemy1

    system: add 1 to enemycounter

    }

    }

    On enemy1 destory -1 from enemycounter

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I attached the picture of my screen. This might help.

  • now what this does is spawn them at the Enemyz1 sprite when ever there is no enemies spawned and you collide with the trigger.

    I need to make it where they will spawn at the closest Enemyz1 sprite not just the one that I hard code in.

    I need some sort of variable that will change depending on which sprite you are closer 2.

    Btw Spawns Enemy 1 is what you should be looking at

    Spawns Enemy 2 is test one I was working on.

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