GameMaker: Studio

GameMaker: Studio

통계 보기:
Worst Player 2016년 10월 3일 오전 5시 22분
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
< >
전체 댓글 2개 중 1~2개 표시 중
Daynar 2016년 10월 3일 오전 8시 06분 
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 2016년 10월 3일 오전 10시 11분 
Correct using of instance_exists:
if instance_exists(obj_player) then { <your code here> }
< >
전체 댓글 2개 중 1~2개 표시 중
페이지당 표시 개수: 1530 50

게시된 날짜: 2016년 10월 3일 오전 5시 22분
게시글: 2