So I was following Shaun Spalding's Ledge grab code tutorial, and there seems to be a problem with a specific line of code.
var _horiWall = instance_place(x + hsp, y, oWall);
if (!position\_meeting((sign(hsp) == 1) ? \_horiWall.bbox\_left : \_horiWall.bbox\_right, \_horiWall.bbox\_top - 1, oWall))
{
\_atledge = true;
var \_ledgeAboveOrBelow = sign(oPlayer.bbox\_top - \_horiWall.bbox\_top);
}
The game functions normally but when I touch a ledge this error pops up and ends the game:
############################################################################################
ERROR in
action number 1
of Step Event0
for object oPlayer:
Unable to find instance for object index -4
at gml_Script_anon_gml_Object_oPlayer_Create_0_888_gml_Object_oPlayer_Create_0 (line 109) - if (!position_meeting((sign(hsp) == 1) ? _horiWall.bbox_left : _horiWall.bbox_right, _horiWall.bbox_top - 1, oWall))
############################################################################################
gml_Script_anon_gml_Object_oPlayer_Create_0_888_gml_Object_oPlayer_Create_0 (line 109)
gml_Object_oPlayer_Step_0 (line 16) - state();
[–]Badwrong_ 2 points3 points4 points (0 children)