GameMaker: Studio

GameMaker: Studio

Statistiken ansehen:
Unable to find any instance for object index '0' name 'obj_player'
i keep getting this error even after i placed instance_exists(obj_player); or if instance_exists(obj)}

Error:
Unable to find any instance for object index '0' name 'obj_player'
at gml_Script_scr_bossIdle (line 3) - var dis = point_distance(x,y,obj_player.x,obj_player.y);

Coding: instance_exists(obj_player);
var dis = point_distance(x,y,obj_player.x,obj_player.y);
if (dis <= 600) {
state = scr_bossAttack;
}

can you help me, im still quite new to gamemaker
< >
Beiträge 12 von 2
That means no player object exists when you try to run the code.
You need to either make sure you create a player object before this code is run or add an if that ensures this code is only run if a player object exists.
Hakase 3. Okt. 2016 um 10:11 
Correct using of instance_exists:
if instance_exists(obj_player) then { <your code here> }
< >
Beiträge 12 von 2
Pro Seite: 1530 50

Geschrieben am: 3. Okt. 2016 um 5:22
Beiträge: 2