Windows Problem with view and viewports

Rexzqy

Member
Hi, so i am trying to limit the vision of the player in the room so they wouldnt see the border. I tried changing view port property and camera property but they did not work. Did i do something wrong?

This is how it looks ingame, i want the player to only able to see as far as the wall goes:

Thank you!
 

Attachments

GML:
//keep camera inside room
x = clamp(x,view_w_half+buff,room_width-view_w_half-buff);
y = clamp(y,view_h_half+buff,room_height-view_h_half-buff);
try using the clamp function!
for my camera theres a buffer zone of 32 pixels around the side of the room to keep it inside
 

Rexzqy

Member
GML:
//keep camera inside room
x = clamp(x,view_w_half+buff,room_width-view_w_half-buff);
y = clamp(y,view_h_half+buff,room_height-view_h_half-buff);
try using the clamp function!
for my camera theres a buffer zone of 32 pixels around the side of the room to keep it inside
Sorry this may be a dumb question, but what if there are multiple rooms? This works fine for the first one, but it doesnt seem to help the second or third one. My codes are below(it's from shaun spaldings tutorial):

cam = view_camera[0];
follow = obj_player;
view_w_half = camera_get_view_width(cam) * 0.5;
view_h_half = camera_get_view_height(cam) *0.5;
xTo = xstart;
yTo = ystart;

if (instance_exists(follow))
{
xTo = follow.x;
yTo = follow.y;
}

x+= (xTo-x)/25;
y+=(yTo-y)/25;

x = clamp(x,view_w_half+buff,room_width-view_w_half-buff);
y = clamp(y,view_h_half+buff,room_height-view_h_half-buff);

Thx a lot for helping!
 

Rexzqy

Member
Another weird thing that keeps happening is sometimes my monster from the outside room comes inside when i go to the inside room...if anyone might have any idea why that happens plz help too! Thx!
 

Rexzqy

Member
Another weird thing that keeps happening is sometimes my monster from the outside room comes inside when i go to the inside room...if anyone might have any idea why that happens plz help too! Thx!
This is solved by making the room persistent instead of making monsters persistent :D
 

Rexzqy

Member
I found a weird but effective way to work around this:

since my inside rooms are all pretty small, i just made the camera not persistent and fixed the view. But if anyone can help me solve this using some more clever way, I'm all ears! Thx!
 
Top