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

Code fail

M

macewindul();

Guest
FATAL ERROR in
action number 1
of Alarm Event for alarm 0
for object cont_enemy_spawn:

Variable obj_enemy.collition(100018, -2147483648) not set before reading it.
at gml_Object_cont_enemy_spawn_ObjAlarm0_1 (line 12) - until spawn_id.collition = 0

this is my create
spawnRate = random_range(60,180);
alarm[0] = spawnRate;

plz help me

i was following a tutorial series and this code didn't work
this is the video that gave me an error
 

Perseus

Not Medusa
Forum Staff
Moderator
Did you declare collition in obj_enemy? Also, shouldn't you have posted the Alarm 0 event code instead? And the Create event of obj_enemy.
 
M

macewindul();

Guest
spawn_id = instance_create(0,0,obj_enemy);
do
{
spawn_id.x = random(room_width);
spawn_id.y = random(room_height);

with (spawn_id)
{
collision = place_meeting(x,y,obj_wall)
}
}
until spawn_id.collition = 0

alarm[0] = spawnRate;
 

Perseus

Not Medusa
Forum Staff
Moderator
collition and collision are two different variables. It should have been spawn_id.collision in the until statement. That's what happens when you try to copy-paste code without trying to understand what it does and how it does it. ;)
 
M

macewindul();

Guest
haha thanks super simple. it's my 3rd time making a game so i'm still getting the hang of it. thanks bro :)
 
Top