J
jhallphx
Guest
Hello,
I am creating a top-down space shooter, much like asteroids meets space invaders. I have all the movement mechanics, firing, collisions, sounds, menus, point system, etc nailed down and am moving on to the finals stages: Enemy Spawning, Wave Generation, and Enemy AI.
Between multiple threads, it has become pretty confusing for a noob like me to compile something because I think I am using pieces from multiple ways of doing it and they are not working together. Since there are more ways that one to skin a cat I think it has convoluted the best way to do it.
My arena looks like this:
What I am trying to accomplish in this phase is this:
(sorry, not sure how to make it go into the black boxes)
Create Event:
//define variables
repeater_value = 5
repeater = repeater_value
//initialize arrays
for(i=0; i<4; i =1){ x=0; y=0 }
//populate arrays (These are the coordinates of my portals)
x[0]=61;
x[1]=957;
x[2]=61;
x[3]=957;
y[0]=62;
y[1]=62;
y[2]=958;
y[3]=958;
Step Event:
if alarm[0] = -1 && repeater > 0 {alarm [0] = room_speed/2}
Alarm[0]
//if alarm[0] = -1 && repeater > 0 {alarm [0] = room_speed/2}
if instance_number(obj_enemy) = 0 && repeater = 0
{
var pos = round(random(3));//..get random, rounded integer from 0 - 3
var eny = instance_create_depth(x[pos], y[pos], 8000, obj_enemy);//..create instance at random position
repeater_value = 5
repeater = repeater_value
}
I have read through these three threads and more, as well as a ton of google searches and tutorial videos on spawning, and have had no luck figuring it out:
Can anyone please post a clear way of doing this so it is easy to learn the actual theory behind it, and not just mindlessly copy/paste someone elses code into my project? The tutorials I have watched don't seem to address this type of game as far as enemy spawning and waves. I am trying to teach myself to code from ground zero through these forums, and it is going well so far
Much Thanks!
JHallPHX
I am creating a top-down space shooter, much like asteroids meets space invaders. I have all the movement mechanics, firing, collisions, sounds, menus, point system, etc nailed down and am moving on to the finals stages: Enemy Spawning, Wave Generation, and Enemy AI.
Between multiple threads, it has become pretty confusing for a noob like me to compile something because I think I am using pieces from multiple ways of doing it and they are not working together. Since there are more ways that one to skin a cat I think it has convoluted the best way to do it.
My arena looks like this:
What I am trying to accomplish in this phase is this:
- Spawn enemies at 4 set locations, randomly. (portals at the corners of the room)
- Delay spawn briefly so the enemies do not pile on top of each other
- After all enemies are destroyed, move onto next wave
- Have number of enemies spawned increase each wave, maxing out at maybe 25 so it's not ridiculous.
- Introduce new enemies (to replace weaker enemies) at more difficult waves
(sorry, not sure how to make it go into the black boxes)
Create Event:
//define variables
repeater_value = 5
repeater = repeater_value
//initialize arrays
for(i=0; i<4; i =1){ x=0; y=0 }
//populate arrays (These are the coordinates of my portals)
x[0]=61;
x[1]=957;
x[2]=61;
x[3]=957;
y[0]=62;
y[1]=62;
y[2]=958;
y[3]=958;
Step Event:
if alarm[0] = -1 && repeater > 0 {alarm [0] = room_speed/2}
Alarm[0]
//if alarm[0] = -1 && repeater > 0 {alarm [0] = room_speed/2}
if instance_number(obj_enemy) = 0 && repeater = 0
{
var pos = round(random(3));//..get random, rounded integer from 0 - 3
var eny = instance_create_depth(x[pos], y[pos], 8000, obj_enemy);//..create instance at random position
repeater_value = 5
repeater = repeater_value
}
I have read through these three threads and more, as well as a ton of google searches and tutorial videos on spawning, and have had no luck figuring it out:
- https://forum.yoyogames.com/index.php?threads/spawning-enemies-in-specific-places-solved.24661/
- https://forum.yoyogames.com/index.p...spawning-x-amount-of-enemies-each-level.8116/
- https://forum.yoyogames.com/index.php?threads/help-with-enemy-spawning-in-fixed-places.15038/
Can anyone please post a clear way of doing this so it is easy to learn the actual theory behind it, and not just mindlessly copy/paste someone elses code into my project? The tutorials I have watched don't seem to address this type of game as far as enemy spawning and waves. I am trying to teach myself to code from ground zero through these forums, and it is going well so far
Much Thanks!
JHallPHX
Last edited by a moderator: