2
I’m doing a game like The Legend Of Zelda in Game Maker Studio 2 but I ended up formatting the pc and when I installed GMS2 again an error started to appear on the Camera Object that was working properly before and without problems, I tried to look at my code where the Game Maker pointed to have an error but the code is right, in my point of view it did not seem to have errors
Step Event
if (object_exists(follow)){
CamTargetX = follow.x;
CamTargetY = follow.y;
}
x+=(CamTargetX - x)/CamSpd;
y+=(CamTargetY - y)/CamSpd;
camera_set_view_pos(cam, x-w_half, y-h_half);
Create
cam = view_camera[0];
follow = obj_player
w_half = camera_get_view_width(cam) / 2;
h_half = camera_get_view_height(cam) / 2;
CamTargetX = xstart;
CamTargetY = ystart;
CamSpd = 25;
EDIT
I tried to look at the index line 24 but the Ob_camera does not reach the line 24 until I looked at the code of the Obj_player but the line 24 is just a command to change the Sprite depending on the direction the player is moving.
which line of the error? for an invalid index error in an array "index 24"
– Ricardo Pontual
In the specific camera object does not go to line 24 but I tried to look at the obj_player and in line 24 of it does not have much just has a code for the direction of the Sprite change depending on which direction it is walking
– Vitor Schutz
At the Step event, you already tried to change the
object_exists(follow)
forinstance_exists(follow)
? From the error, it seems that the object instance "index 24" no longer exists.– Gomiero
I managed to solve thank you :D
– Vitor Schutz