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

Get help using Construct 2

Post » Sun Jun 10, 2012 8:48 am

Hi !
I'm learning Construct 2 by making an old fashioned shoot'em up.

Actually, this is how I manage to create my waves of enemies :



I think it's quite clear.
However, you can see that there are some redundant events from wave 1 to wave 2...
I currently use two objects (wave1 and wave2) that have similar variables : startTime, lenght, number of enemies, etc.

So here are my two questions :

1) I started to create some wave1 and wave2 elements on a "wave" family. A wave is an "virtual" concept, not a sprite or something like that. Actually, I created "texts" objects and put instance variables on them. What object is the best designed for this type of element that will only contain variables?

2) To prevent my events redudancy, I would like to use the wave family. Actually, my project doesn't use it.
But I didn't manage to write my wave events based on the wave family. Every time I tried (with a "for each [wave]"), something was wrong, such as enemies coming every tick and so on.
Could someone help me with that issue and help me to create a simple event list based on my wave family?

So the only thing I would have to change to create a new wave would be the related actions (and maybe add specifical conditions).

Here's my capxCanapin2012-06-10 12:17:05
B
5
S
1
Posts: 34
Reputation: 1,026

Post » Sun Jun 10, 2012 11:40 am

I'll create you one from scratch and show you how simple it can be! ;) Give me some time.
B
17
S
4
G
5
Posts: 226
Reputation: 4,042

Post » Sun Jun 10, 2012 12:17 pm

Thank you :)
I've worked on it and I think I'm getting closer :



Only issue, the second wave won't start... Do you know why ?

I've updated my .capx : http://canapin.com/shooter/Paper%20Shooter.capxCanapin2012-06-10 12:31:06
B
5
S
1
Posts: 34
Reputation: 1,026

Post » Sun Jun 10, 2012 12:24 pm

The way I work "waves" is in one, I don't do a new event for every wave, what if you had 600 waves? That's why I present you with this:





Download: MediaFire (Click Me)
B
17
S
4
G
5
Posts: 226
Reputation: 4,042

Post » Sun Jun 10, 2012 12:39 pm

Small question : is it possible to check the IID of an object? Like "if object.IID = " ?

I checked at your wave system.
It's simple and functional, but I don't think it fits on my gameplay.
I need the waves to be flexibles and with various content.

You an check my previous message to see what I'd like to approach.

I think it could work this way, but it doesn't launch the second wave, dunno why.

It's unlikely I will have hundred of waves, I'm making a short shoot'em up with a limited number of waves per level.

My gameplay inspirations are Xenon 2 and Jamestown.Canapin2012-06-10 12:43:56
B
5
S
1
Posts: 34
Reputation: 1,026

Post » Sun Jun 10, 2012 12:47 pm

dcrew tackled the problem in the proper way.
If you end up with 30 waves and you need to change something, you'll need to change it for all 30 waves. That's a real pain.
You need to be able to encompass all your needs in only one configurable wave you restart each time. With just the number of the wave which change over time.

One way to add flexibility is to use an array of parameters like
Array.At(waveNumber,0) = number of ennemies
for a list of enemies
Array.At(waveNumber,1,0) = number representing an enemy type
Array.At(waveNumber,1,1) = number representing an enemy type
Array.At(waveNumber,1,2) = number representing an enemy type
etc
And use these information to spawn the proper number of enemy and type of enemy.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun Jun 10, 2012 1:20 pm

As @Yann said, My solution is proper, the very correct solution for you. Very optimized compared to writing out every wave in separate events.

My solution can be modified easily to allow for different types of enemies. I'm sure you can figure that bit out by yourself ;)

Good luck!
B
17
S
4
G
5
Posts: 226
Reputation: 4,042

Post » Sun Jun 10, 2012 2:54 pm

I'd like to be sure to understand because I'm a noob.
Does your solution allow to have several waves on the layout at the same time?
Like a new one which appears on the screen while the second isn't finished yet?
B
5
S
1
Posts: 34
Reputation: 1,026

Post » Sun Jun 10, 2012 4:10 pm

depends, but yeah it could
If you keep track of each waves timing via the array I mentionned
Like

Array.At(wavenumber,2) = startTime
Array.At(wavenumber,3) = countDown
Array.At(wavenumber,4) = rate
you can use the 'countDown' and the rate value to control the spawning of each wave of monster, instead of using a global "every x seconds"

So each tick you check for each possible wave, if the startTime is exceeded, if it is, you check the 'countDown',
if it's equal to 0 you spawn the next enemy and add 'rate' to the 'countDown',
else you substract dt to it.

Something along these lines
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun Jun 10, 2012 9:19 pm

Thank you for your help :)
B
5
S
1
Posts: 34
Reputation: 1,026

Next

Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, Unconnected, Yahoo [Bot] and 32 guests