My idea is: I use three views, (0, 1 and 2). 0 is background, 1 is hud, 2 is playable area. 2 is above 1 and 1 is above 0. I have a start room were I iniciate the camera and in the next step I change rooms.
view 0 stays in cords (0, 0). view 1 stays in cords (480, 0), at the right of view 0.
The views logic are written by code, but 🎶 for some reason I can explain 🎶 the game uses the default numbers in the view room section.
And before you say, NO, the cameras are not active nor visible in any room.
In objCamera:
Create Event
window_set_size(VIEW_0_W * 2, VIEW_0_H * 2);
surface_resize(application_surface, VIEW_0_W * BASE_FACTOR, VIEW_0_H * BASE_FACTOR);
alarm[0] = 1;
End Step Event
if (!instance_exists(objPlayer)) exit;
var _x = (objPlayer.x div VIEW_2_W) * VIEW_2_W;
var _y = (objPlayer.y div VIEW_2_H) * VIEW_2_H;
_x = clamp(_x, 0, room_width - VIEW_2_W);
_y = clamp(_y, 0, room_height - VIEW_2_H);
camera_set_view_pos(VIEW_2, _x, _y);
if keyboard_check_released(ord("K")) {
if window_get_fullscreen() {
window_set_fullscreen(false);
}
else {
window_set_fullscreen(true);
}
}
Alarm 0:
window_center();
room_goto(Room2);
Room initiation
view_visible[0] = true;
view_visible[1] = true;
view_visible[2] = true;
view_enabled = true;
camera_set_view_size(VIEW_0, VIEW_0_W, VIEW_0_H);
camera_set_view_size(VIEW_1, VIEW_1_W, VIEW_1_H);
camera_set_view_size(VIEW_2, VIEW_2_W, VIEW_2_H);
camera_set_view_pos(VIEW_0, 0, 0);
camera_set_view_pos(VIEW_1, 480, 0);
For now, the player just moves freely with simple code:
In objPlayer, Step Event
var hmove = keyboard_check(vk_right) - keyboard_check(vk_left);
var vmove = keyboard_check(vk_down) - keyboard_check(vk_up);
x += hmove2;
y += vmove2;
My question is simple, does someone have an idea of what may cause this and how could I fix this?
I have a script called "viewMacros" where i initialize de macros used for the views: