0
\$\begingroup\$

I have been following the tutorial videos on game maker, and I am at the part where he explains how to get the bullet under the character. I thought I did everything right. He then tested the game, and it worked. But when I played, and tried to shoot, this message appeared:


#

FATAL ERROR in action number 1 of Step Event0 for object obj_player:

Variable obj_player.layer_bullet(100002, -2147483648) not set before reading it. at gml_Object_obj_player_Step_0 (line 30) - instance_create_layer(x, y, layer_bullet, obj_bullet);

#
\$\endgroup\$
  • \$\begingroup\$ Have you created a layer with name layer_bullet in room or using layer_create() function? \$\endgroup\$ – Dmi7ry Sep 10 '17 at 6:06
1
\$\begingroup\$

Layers have to be referenced via their name, provided as a string. Try changing your create function in the step event to

instance_create_layer(x, y, "layer_bullet", obj_bullet
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.