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

0 favourites
From the Asset Store
Waves SFX Sea & Ocean contains 170 seamless loops.
  • 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 capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'll create you one from scratch and show you how simple it can be! ;) Give me some time.

  • 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 : canapin.com/shooter/Paper%20Shooter.capx

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

    <img src="http://screensnapr.com/e/8bATUu.jpg" border="0">

    <img src="http://screensnapr.com/e/H99Bbm.jpg" border="0">

    Download: MediaFire (Click Me)

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

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

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

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

  • 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

  • Thank you for your help :)

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

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

    example

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

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

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

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