Christopher Alexander
Member
Instead of creating a new thread I thought I'd just add to this one.
MOD EDIT: Posts have been split from the linked topic above into their own topic.
My parallax stopped working when I changed camera.
My parallax code is in it's own object in the step event:
It worked fine when I used the regular camera and object following my player object, but I recently switch to Spaldings "Smooth Camera Tutorial" and it stopped working. I can't seem to figure out what I should change for it to work.
Spalding style camera object:
Create
Step:
MOD EDIT: Posts have been split from the linked topic above into their own topic.
My parallax stopped working when I changed camera.
My parallax code is in it's own object in the step event:
GML:
var cam_x = camera_get_view_x(view_camera[0]);
var cam_y = camera_get_view_y(view_camera[0]);
layer_x("Parallax_01", cam_x * 0.25);
layer_y("Parallax_01", cam_y * 0.25);
Spalding style camera object:
Create
GML:
camera = camera_create();
var vm = matrix_build_lookat(x, y, -10, x, y, 0, 0,1,0);
var pm = matrix_build_projection_ortho(640, 360, 1, 10000);
camera_set_view_mat(camera, vm);
camera_set_proj_mat(camera, pm);
view_camera[0] = camera;
follow = obj_player;
xTo = x;
yTo = y;
GML:
x += (xTo - x)/5;
y += (yTo - y)/5;
if (follow != noone)
{
xTo = follow.x;
yTo = follow.y - 50;
}
var vm = matrix_build_lookat(x, y, -10, x, y, 0, 0, 1, 0);
camera_set_view_mat(camera, vm);
Last edited by a moderator: