Anthony Nguyen
Anthony Nguyen

Reputation: 1

Game Maker Studio views not working

So I'm relatively new to coding and I'm using Game Maker Studio for now.

I'm using gml to create the view of the game with the code:

Assuming the window width is 1280 and window height is 720, the obj_player is the main object of the view:

if (window_get_fullscreen() == false){
view_visible[0] = true; //Assume from here that everything is on view[0]
view_wview = window_get_width;
view_hview = window_get_height;
view_xview = obj.player.x - view_wview/2;
view_yview = obj.player.y - view_hview/2;
view_xport = 0;
view_yport = 0;
view_wport = window_get_width;
view_hport = window_get_height;
}

All of this is in a step event of an object that controls the room's view.

The room that I have the view in is 1800x1800, and the window size is only 1280x720. When the room is shown, the entire room is shown in the 1289x720 window instead of the 1280x720 view which should only show only part of the room.

Right now, all the sprites are stretched to be vertically flat because the code is trying to squeeze a 1800x1800 room into a 1280x720 window, but how can I make it so only 1280x720 of the full room is shown in the 1280x720 view?

Upvotes: 0

Views: 1425

Answers (1)

Dmi7ry
Dmi7ry

Reputation: 1777

If you want to use views, you need enable it.

GM Views option

Or enable it using code:

view_enabled = true;

Upvotes: 2

Related Questions