6
66Gramms
Guest
Hello!
I'm making a game and on a few levels I want survival mode. For this i made a spawner object that has 2 variables
1. Enemy type //Which enemy to spawn
2. Delay //Delay beetwen spawns
When the player enter a level the level is being called from a script (the script spawns all the objects) and there when i create the spawner i use "with"
(see the exact script)
When i run the game it creates the first enemy instantly (just as i want) but after 10 seconds I get this error
In the alarm 0 event i have this code
Also originally i had these vars set up in the create event but it overwrote what i gave in the script so now the create event of the spawning object is empty. (all it has is "visible = false") I want to use this object on different levels and with different values. How could i solve this? Thank you in advance
I'm making a game and on a few levels I want survival mode. For this i made a spawner object that has 2 variables
1. Enemy type //Which enemy to spawn
2. Delay //Delay beetwen spawns
When the player enter a level the level is being called from a script (the script spawns all the objects) and there when i create the spawner i use "with"
(see the exact script)
Code:
obj_2587=instance_create(960,555,obj_spawner) with obj_2587 {enemType = obj_mainEnemy; delay = 10*room_speed; alarm[0] = delay; instance_create(x,y,obj_mainEnemy);}
Code:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Alarm Event for alarm 0
for object obj_spawner:
Variable obj_spawner.enemyType(100534, -2147483648) not set before reading it.
at gml_Object_obj_spawner_ObjAlarm0_1 (line 2) - instance_create(x,y,enemyType);
############################################################################################
Code:
///Spawning enemies
instance_create(x,y,enemyType);
alarm[0] = delay;