0

I'm using Gamemaker studio 2 and I am fairly new keep in mind but I am fairly certain this isn't a problem on my side. I've been watching a youtube series on creating my first game using GML and my code looks EXACTLY like his and is not working.

if (mouse_check_button(mb_left)) {
    instance_create_layer(x, y, "Layer_Bullet", obj_bullet);
}

This is where I'm getting an error. The error says:

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

instance_create_layer :: specified layer "Layer_Bullet" does not exist
 at gml_Object_obj_player_Step_0 (line 11) -        instance_create_layer(x, y, "Layer_Bullet", obj_bullet);
##############################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_player_Step_0 (line 11)

I have checked nearly 3000 times (exaggerated obviously) to make sure that the spelling is correct. I've renamed the layer, tried using a different layer. Nothing works.

Steven
  • 1,996
  • 3
  • 22
  • 33
Trevn Jones
  • 341
  • 2
  • 4
  • 11
  • Share the project (file → export project) – Dmi7ry Dec 27 '17 at 10:05
  • Can you show us the room where you create your layers? Or like Dmi7ry said, share the project file itself? – Steven Jan 04 '18 at 11:25
  • > We need to see the room, but check if the layer is in that specific room and that you have spelt it properly. The only way this can be diagnosed Properly is if you show us a picture. – Silk Jul 12 '18 at 21:34

2 Answers2

0

Place an instance of a bullet somewhere in the scene....in the room to be specific.

that should work...let me know.

xxpilotxx
  • 1
  • 1
0

You need create a layer first:

your_layer = layer_create(depth,"Type the Name");
your_inst_layer = instance_create_layer(x,y,"Type Layer Name Now",your_obj);

Thats fixed for me!

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Xt777Br
  • 1
  • 1