M
MrSanfrinsisco
Guest
I'm creating a game called bomb run and in the bomb spawner object I have 3 alarms. One alarm creates the bomb somewhere random in the map, another alarm decreases the spawn rate of the bombs but does not let it hit 0, and the third one makes the bomb animation play faster so the bombs will explode faster and faster as the game plays on. That's where I'm having problems Let me show my code and then explain what's going wrong.
Create Event
Alarm 0 Event
Alarm 2 Event
Here's the error I'm getting as soon as a bomb spawns in the game:
############################################################################################
FATAL ERROR in
action number 1
of Alarm Event for alarm 0
for object obj_bomb_spawner:
Variable obj_bomb.imageSpeed(100012, -2147483648) not set before reading it.
at gml_Object_obj_bomb_spawner_Alarm_0 (line 3) - image_speed = imageSpeed;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_bomb_spawner_Alarm_0 (line 3)
The error is saying that imageSpeed is not set before reading it but if you look in the create event imageSpeed clearly is set to 1. So I'm failing to understand what's going wrong here.
Ignore the imageSpeed += 2; I know in Game Maker studio 2 it works as a multiplier, The variables I have set right now are for testing.
Create Event
Code:
spawnRate = 60;
spawnRateDecrease = 60*7;
bombExplodeRate = 60;
imageSpeed = 1;
alarm[0] = spawnRate;
alarm[1] = spawnRateDecrease;
alarm[2] = bombExplodeRate;
Code:
with (instance_create_layer(random(room_width), random(room_height),
"lyr_bombs", obj_bomb)) {
image_speed = imageSpeed;
}
alarm[0] = spawnRate;
Code:
imageSpeed += 2;
alarm[2] = bombExplodeRate;
############################################################################################
FATAL ERROR in
action number 1
of Alarm Event for alarm 0
for object obj_bomb_spawner:
Variable obj_bomb.imageSpeed(100012, -2147483648) not set before reading it.
at gml_Object_obj_bomb_spawner_Alarm_0 (line 3) - image_speed = imageSpeed;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_bomb_spawner_Alarm_0 (line 3)
The error is saying that imageSpeed is not set before reading it but if you look in the create event imageSpeed clearly is set to 1. So I'm failing to understand what's going wrong here.
Ignore the imageSpeed += 2; I know in Game Maker studio 2 it works as a multiplier, The variables I have set right now are for testing.