How do I easily handle waves of enemies (shmup) ?

Get help using Construct 2

Post » Fri Jun 15, 2012 12:08 pm

Greetings again !

I'm trying to make another "wave manager" kind of "more intuitive" so I'm reworking on all my wave system.

Here's my layout :



The wave sprites have each an ID variable : 0, 1, 2.
They also have variables like the wave length, number of generated enemies, ID of generated enemies.

They also have a bullet behavior, so they're slowly moving down until they reach the player screen.

When they reach screen, they stop moving and generate several enemies at regular intervals from their X-Y coordinates.




The problem that I have is that my conditions can't target a specific wave.

For example, actually the wave sprite is destroyed when it has spawn all its enemies.

The first wave generate 5 enemies, the second wave 2, and the third 4.
When the first wave has generated 2 enemies, the second wave is destroyed. On the fourth generated enemy, the third wave is destroyed.

To apply these conditions on the same wave sprite, I tried to use a foreach wave loop. But that's doesn't work, because the first loop has to finish spawning its enemies, before starting the second wave.

So, any idea to have several waves spawning enemies at the same time, based on my capx?

Here is my capx : canapin.com/shooter/test.capxCanapin2012-06-15 12:11:44
B
5
S
1
Posts: 34
Reputation: 1,026

Post » Fri Jun 15, 2012 12:31 pm

i think i have a solution, if i understood the question right

example
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Fri Jun 15, 2012 1:22 pm

Thanks, that's a start!

The thing is, I would like, for example, wave 2 starting to spawn enemies while the wave 1 is also currenty spawning enemies.

Basically, each wave should spawn their own enemies when reaching the player's screen, regardless other waves's status.Canapin2012-06-15 13:31:59
B
5
S
1
Posts: 34
Reputation: 1,026

Post » Fri Jun 15, 2012 1:29 pm

This sprite thing is a nice idea
To handle what you ask, you should just set a counter variable on your sprite and decrease it each time you spawn an enemy related to this sprite.
If the counter reach 0 you destroy it.

Now I wonder why you use a family for that thoughYann2012-06-15 13:30:46
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Fri Jun 15, 2012 4:00 pm

I use a family because each wave sprite will have similar variables : wave length, number of enemies spawned, etc.

I don't really see how I could manage to create a wave system without putting them into a family.

But because I use a family, I can't use a foreach loop because each loop will wait to spawn all a wave's enemies before a new one starts. I'm kind of stuck.
B
5
S
1
Posts: 34
Reputation: 1,026

Post » Fri Jun 15, 2012 4:12 pm

You can always have a look at demos, in the Space Ship demo, he uses a good way of spawing enemies, may be this could help you

http://www.scirra.com/construct2/demos/space-blaster
B
28
S
5
G
4
Posts: 51
Reputation: 3,857

Post » Fri Jun 15, 2012 6:25 pm

you could have done it with just an instance with different variables,

anyway it should evenly work with families,

i have here a version that can spawn at equal time, but havent found how you can with there own timing @Yann , maybe you know a way? im interested myself too, cant find it

example
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Fri Jun 15, 2012 6:59 pm

I think giving every sprite it's own timer is best for things like this. 'Every x seconds' won't work as you want it to for multiple sprites.

timedWaves.capx
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Fri Jun 15, 2012 7:06 pm

i finaly found a solution for it, maybe you still want to use it

generator

ah ramones beat me to it :) yours better with dtvtrix2012-06-15 19:08:54
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Fri Jun 15, 2012 10:20 pm

Your solutions seems to be great!

My goal is to have a game I could easily modify : change, remove or add enemies, weapons, bonuses... and manage waves with different patterns and so on.

Thanks for your help, as usual ! :)
B
5
S
1
Posts: 34
Reputation: 1,026

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: fredriksthlm, marekmk and 1 guest