Papa Doge
Member
Hello,
The height of my game is being squished for an unknown reason.
I'm having trouble tracking down the root cause of my game's resolution issues. I've watched the videos by Pixelated Pope and that didn't fix my issue either. I'm wondering if there's still something fundamental I'm missing or if there's some random bit of code in my game that junking things up.
As you can see in the attached screenshot, it's the draw event's content that is messed up but for whatever reason the GUI layer seems to be drawing correctly.
Here are my settings:
Room
5152 x 3808
Viewport 0
Camera: 728 x 432
Viewport: 728 x 432
Then I use a camera object from Shaun Spaulding platformer tutorial series to center on the player and clamp the view when I do screen shakes.
---
I pretty sure it's not the camera becuase I turned that object off and the game is still getting squished. Then I thought maybe my room being such a strange size might be the issue. So I made it 1920 x 1080 just to see if everything being the same aspect ratio would fix the issue. It did not.
From what I gather, the room size does not matter but the camera and viewport aspect ratios must be the same. So I could make the viewport 2x the camera to scale my game by 2x. This is my goal but as I said, I'm not sure why anything is getting squished when both my camera and my viewport are identical.
Could it be something with the application surface? Something else? I'm a bit stuck.
The height of my game is being squished for an unknown reason.
I'm having trouble tracking down the root cause of my game's resolution issues. I've watched the videos by Pixelated Pope and that didn't fix my issue either. I'm wondering if there's still something fundamental I'm missing or if there's some random bit of code in my game that junking things up.
As you can see in the attached screenshot, it's the draw event's content that is messed up but for whatever reason the GUI layer seems to be drawing correctly.
Here are my settings:
Room
5152 x 3808
Viewport 0
Camera: 728 x 432
Viewport: 728 x 432
Then I use a camera object from Shaun Spaulding platformer tutorial series to center on the player and clamp the view when I do screen shakes.
Code:
// CREATE EVENT
/* -------------------- */
// Variable to identify the default camera so we can do things to it...
cam = view_camera[0];
// Variable to store the object we want the camera to be following...
follow = obj_player_suit;
// Variables to store half the width and height so that the camera can be positioned on the center of the subject...
half_camera_width = camera_get_view_width(cam) * 0.5;
half_camera_height = camera_get_view_height(cam) * 0.5;
// Variables to store where we want the camera to go with defaults at the camera objects starting location...
x_target = x;
y_target = y;
// camera shake
shake_length = 0; // 30 is half a real world second of shaking...
shake_magnitude = 0; // how much it will shake the camera in pixels...
shake = 0; // variable to store current remaining shake value...
shake_buffer = 32; // so you don't shake off the screen...
// STEP EVENT
// if the subject still exists...
if (instance_exists(follow)) {
// grab the x and y coords of the subject and store them as variables...
x_target = follow.x;
y_target = follow.y;
}
// incrementally update the camera's position to follow the subject so it's fast when far away and slow when close...
x += (x_target - x) / 10;
y += (y_target - y) / 10;
// restrict the position of the camera so that it can't go outside the bounds viewport...
x = clamp(x,half_camera_width+shake_buffer,room_width-half_camera_width-shake_buffer);
y = clamp(y,half_camera_height+shake_buffer,room_height-half_camera_height-shake_buffer);
// camera shaking here...
x += random_range(-shake,shake);
y += random_range(-shake,shake);
shake = max(0,shake-((1/shake_length)*shake_magnitude)); // remove 1/60 of shake's value every frame so that in 60 frames (one real world second) the shake will end...
// update the camera so that it is centered on the player instead of being in the top left...
camera_set_view_pos(cam,x-half_camera_width,y-half_camera_height);
I pretty sure it's not the camera becuase I turned that object off and the game is still getting squished. Then I thought maybe my room being such a strange size might be the issue. So I made it 1920 x 1080 just to see if everything being the same aspect ratio would fix the issue. It did not.
From what I gather, the room size does not matter but the camera and viewport aspect ratios must be the same. So I could make the viewport 2x the camera to scale my game by 2x. This is my goal but as I said, I'm not sure why anything is getting squished when both my camera and my viewport are identical.
Could it be something with the application surface? Something else? I'm a bit stuck.
Attachments
-
368.1 KB Views: 13
Last edited: