R
r0sh
Guest
I'm having some issues with camera and updating views. I have a camera object with the following create and step events. A lot of this was pulled from Shawn S's platformer tutorial.
Create event.
Step event:
The debug messages show everything updating appropriately, but the camera view is not updating on screen. I've added the camera object to room. The camera view just stays at 0,0. Not sure exactly what's happening here.
Edit: it looks like my view port x and y are not being updated..
Edit2: This started working.... /shrug
Create event.
Code:
cam = view_camera[0];
follow = objPlayer;
view_w_half = camera_get_view_width(cam) * 0.05;
view_h_half = camera_get_view_height(cam) * 0.05;
xTo = xstart;
yTo = ystart;
Code:
if (instance_exists(follow)) {
xTo = follow.x;
yTo = follow.y;
}
x += (xTo - x) / 25;
y += (yTo - y) / 25;
camera_set_view_pos(cam, x - view_w_half, y - view_h_half);
show_debug_message("xTo: " + string(xTo) + " yTo: " + string(yTo) + " Cam x: " + string(x) + " Cam y: " + string(y))
show_debug_message("where cam should be: " + " viewWHalf: " +string(x-view_w_half) + " viewYHalf: " + string(y-view_h_half));
show_debug_message("CamX: " + string(camera_get_view_x(cam)) + " CamY: " + string(camera_get_view_y(cam)));
show_debug_message("objX: " + string(x) + " objY: " + string(y));
Edit: it looks like my view port x and y are not being updated..
Edit2: This started working.... /shrug
Last edited by a moderator: