Legacy GM Struggling with camera object and views

AiNaKa

Member
So I wanted to try and make the view move dynamically between "subrooms". I created this system for subrooms, where when a player collides with a specific object, it will define the subroom, and a seperate object will define the dimensions of said subroom within the room. The camera object is supposed to be made to stay within the boundaries of the subroom, so that it can move the view dynamically between the rooms, except the camera object just gets stuck instead, I don't know what I'm doing wrong.

Step event code for camera:
Code:
x = obj_player.x;
y = obj_player.y;

if corner_1_x <= global.room_corner_1_x
{
    x = global.room_corner_1_x + 640;
}
if corner_1_y <= global.room_corner_1_y
{
    y = global.room_corner_1_y + 360;
}

if corner_2_x >= global.room_corner_2_x
{
    x = global.room_corner_2_x - 640;
}
if corner_2_y >= global.room_corner_2_y
{
    y = global.room_corner_2_y - 360;
}
Create event for camera:
Code:
corner_1_x = x - 640
corner_1_y = y - 360
corner_2_x = x + 640
corner_2_y = y + 360
Code for object that defines subroom:
Code:
if place_meeting(x,y,obj_player)
{
    subroom = 1
}
Different objects are designated for different subrooms.

Current code for the subroom manager:
Code:
if global.subroom = 1
    {
        global.room_corner_1_x = 0
        global.room_corner_1_y = 0
        global.room_corner_2_x = 768
        global.room_corner_2_y = 3072
    }
    if global.subroom = 2
    {
        global.room_corner_1_x = 2816
        global.room_corner_1_y = 0
        global.room_corner_2_x = 4096
        global.room_corner_2_y = 2304
    }
The view size is 1280x720, and so is the camera object's sprite, its origin is set to center. Whenever I playtest the game, the camera object's origin gets stuck at about 128,384 (not sure on the exact coordinates). It won't budge when the player moves anywhere, and it certainly won't even stay within the boundaries of the subroom. The view just stays at 0,0. What should I do to keep the camera object from getting stuck at these coordinates for seemingly no reason?
 
Top