• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

How to make the enemies spawn after? (Experts)

B

buminzy

Guest
How to make the enemies spawn after 8 seconds of the game starting, not right away?
 
Last edited by a moderator:

Smiechu

Member
Create a new object or add to one of your "general" objects ie. "obj_game" which governors the game.
There you make a simple counter...
Code:
If alarm[0] == -1
  {
  alarm[0] = 30
  global.counter += 1
  }
Then the spawning code of you're enemy embeed in if global.counter > 9

Of course course alarm must be set to you frame rate and global.counter must be given in create event with 0 value.

If you don't need the counter later on in the game you can add one more if global.counter < 10
 

Fabseven

Member
You sure got an obj_system or something similar.
Set an alarm of your choice in the create event at room_speed*8
When the alarm is at zero you can create your mobs or activate them.

I think it's better to desactivate all monster at start end then active them so :

Create
Code:
alarm[0] = room_speed*8
instance_deactivate_object(obj_monster) //obj_monster = yours monsters (could be a parent obj)
In alarm0 event just add a commentary (if not the alarm will not decrease)

in Step event
Code:
if(alarm[0] == 0)
{
   alarm[0] = noone //so the alarm will not trigger with part of code again
   instance_activate_object(obj_monster)   
}
 
B

buminzy

Guest
I like that you Explain it @Fabseven but when I put your code, for some reason the enemies aren't spawning.

I really need this for my game if you could help me with this.
 
B

buminzy

Guest
And remember my enemies aren't build in coding. They are build in drag & drop. Check UP, and see how I made them
 
Top