M
McSpooky
Guest
Sorry if this was mentioned, I did some searches but was unsuccessful
I was running through the GML version of the tutorial for space rocks and run into a problem with splitting the rocks when you shoot them.
The code provided in video and tutorial window results in an error. I know it happens when it tries to create a new instance and change the variable for the rocks to pick medium for a big rock and small for a medium rock. But I do not understand why or how to fix it.
I get this error :
this is the code, I hope someone can help/explain to me what is wrong here. Thanks
I was running through the GML version of the tutorial for space rocks and run into a problem with splitting the rocks when you shoot them.
The code provided in video and tutorial window results in an error. I know it happens when it tries to create a new instance and change the variable for the rocks to pick medium for a big rock and small for a medium rock. But I do not understand why or how to fix it.
I get this error :
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Eventobj_astroid
for object obj_bullet:
Variable <unknown_object>.spr_asteroid_huge(100002, -2147483648) not set before reading it.
at gml_Object_obj_bullet_Collision_a75d1f6b_ccf7_4d2c_b1e9_d1b0214d6179 (line 6) - if (sprite_index == spr_asteroid_huge)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_bullet_Collision_a75d1f6b_ccf7_4d2c_b1e9_d1b0214d6179 (line 6)
this is the code, I hope someone can help/explain to me what is wrong here. Thanks
Code:
with (other)
{
instance_destroy();
if (sprite_index == spr_asteroid_huge)
{
repeat(2)
{
var new_asteroid = instance_create_layer(x, y, "Instances", obj_asteroid);
new_asteroid.sprite_index = spr_asteroid_med;
}
}
else if (sprite_index == spr_asteroid_med)
{
repeat(2)
{
var new_asteroid = instance_create_layer(x, y, "Instances", obj_asteroid);
new_asteroid.sprite_index = spr_asteroid_small;
}
}
repeat(10)
{
instance_create_layer(x, y, "Instances", obj_debris);
}
}