How do I make a enemy spawn manager?

Get help using Construct 2

Post » Fri Mar 28, 2014 9:53 am

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?
B
29
S
6
G
1
Posts: 93
Reputation: 3,020

Post » Sun Mar 30, 2014 5:17 am

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?
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Mon Mar 31, 2014 6:02 am

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?
B
29
S
6
G
1
Posts: 93
Reputation: 3,020

Post » Mon Mar 31, 2014 12:49 pm

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 :D
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Tue Apr 01, 2014 12:12 am

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
B
29
S
6
G
1
Posts: 93
Reputation: 3,020

Post » Tue Apr 01, 2014 12:16 am

I attached the picture of my screen. This might help.
You do not have the required permissions to view the files attached to this post.
B
29
S
6
G
1
Posts: 93
Reputation: 3,020

Post » Tue Apr 01, 2014 12:48 am

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.
B
29
S
6
G
1
Posts: 93
Reputation: 3,020


Return to How do I....?

Who is online

Users browsing this forum: jaytrott86, Lancifer and 8 guests