A
André Guilherme
Guest
Hey everyone! Hope i'm posting this in the right place...
Here's the problem:
I've been testing art and game mechanics in a room called rm_test.
The room is 1366x768.
I also have a obj_camera which controls the view's x, y, width and height, and view_port dimensions as well.
The width and height values of the view are 820x481 and the values of the view_port are 1366x768 (all set in the create event of obj_camera).
This works wonderfully (as seen in one of the images below - the one with most art assets).
Eventually i tried to create a new level from the ground up.
So i created a new room -- rm_stage1 -- and started to set dimensions and a few objects and tested the room.
The resolution was weird and everything that was drawn on the GUI layer was out of place.
I've googled it and tried a few alternatives, like reseting application surface and setting gui display size, but nothing worked and I didn't found much info.
Right now I recreated the room to have 1500x768 and i'm the sure the problem has to do with room size and something else (There's an image of this result as well)
What I don't get is why the view width and height (or/and the view port width ad height) values are changing or not being applied correctly, when everything ran smoothly on the rm_test.
Here's the camera code:
Does anyone know what might be causing this?
Thanks in advance!
Here's the problem:
I've been testing art and game mechanics in a room called rm_test.
The room is 1366x768.
I also have a obj_camera which controls the view's x, y, width and height, and view_port dimensions as well.
The width and height values of the view are 820x481 and the values of the view_port are 1366x768 (all set in the create event of obj_camera).
This works wonderfully (as seen in one of the images below - the one with most art assets).
Eventually i tried to create a new level from the ground up.
So i created a new room -- rm_stage1 -- and started to set dimensions and a few objects and tested the room.
The resolution was weird and everything that was drawn on the GUI layer was out of place.
I've googled it and tried a few alternatives, like reseting application surface and setting gui display size, but nothing worked and I didn't found much info.
Right now I recreated the room to have 1500x768 and i'm the sure the problem has to do with room size and something else (There's an image of this result as well)
What I don't get is why the view width and height (or/and the view port width ad height) values are changing or not being applied correctly, when everything ran smoothly on the rm_test.
Here's the camera code:
///Activate Camera's View
if !view_enabled
{
view_visible[0] = true;
view_enabled = true;
}
//Screen measurements
max_width = 1366;
max_height = 768;
zoomOut_width = 911;
zoomOut_height = 512;
normal_width = 820;
normal_height = 461;
width = normal_width;
height = normal_height;
//Width and Height, X and Y of View Port (Dimensions of view on screen)
view_wport[0] = 1366; //So it fills the screen
view_hport[0] = 768; //So it fills the screen
view_xport[0] = 0; //So it's in the left upper corner of the screen
view_yport[0] = 0; //So it's in the left upper corner of the screen
//Initial View Position
x = 0;
y = 0;
//Movement Variables
target_x = 0;
target_y = 0;
x_speed = 0;
y_speed = 0;
max_x_spd = 16;
max_y_spd = 16;
accel = 2;
fric = 0.1;
out_of_bounds_x = false;
out_of_bounds_y = false;
if !view_enabled
{
view_visible[0] = true;
view_enabled = true;
}
//Screen measurements
max_width = 1366;
max_height = 768;
zoomOut_width = 911;
zoomOut_height = 512;
normal_width = 820;
normal_height = 461;
width = normal_width;
height = normal_height;
//Width and Height, X and Y of View Port (Dimensions of view on screen)
view_wport[0] = 1366; //So it fills the screen
view_hport[0] = 768; //So it fills the screen
view_xport[0] = 0; //So it's in the left upper corner of the screen
view_yport[0] = 0; //So it's in the left upper corner of the screen
//Initial View Position
x = 0;
y = 0;
//Movement Variables
target_x = 0;
target_y = 0;
x_speed = 0;
y_speed = 0;
max_x_spd = 16;
max_y_spd = 16;
accel = 2;
fric = 0.1;
out_of_bounds_x = false;
out_of_bounds_y = false;
///View X and Y
if (mouse_check_button(mb_right))
{
target_x = (obj_player.x+((mouse_x-obj_player.x)/4)) - (view_wview[0]/2.5);
target_y = (obj_player.y+((mouse_y-obj_player.y)/3)) - (view_hview[0]/2);
}
else
{
target_x = (obj_player.x+((mouse_x-obj_player.x)/10)) - (view_wview[0]/2.5);
target_y = (obj_player.y+((mouse_y-obj_player.y)/10)) - (view_hview[0]/2);
}
//Zoom
scr_view_zoom();
//Apply coordinates to view 'x' and 'y'
view_xview[0] = x;
view_yview[0] = y;
///Control View
//Width and Height
view_wview[0] = width;
view_hview[0] = height;
//View Limits (Edges of room)
if (view_xview[0] < 0)
{
out_of_bounds_x = true;
view_xview[0] = 0;
}
else
if (view_xview[0] > room_width - width)
{
out_of_bounds_x = true;
view_xview[0] = room_width - width;
}
else
{
out_of_bounds_x = false;
}
if (view_yview[0] < 0)
{
out_of_bounds_y = true;
view_yview[0] = 0;
}
else
if (view_yview[0] > room_height - height)
{
out_of_bounds_y = true;
view_yview[0] = room_height - height;
}
else
{
out_of_bounds_y = false;
}
(IN END-STEP)
///Follow player smoothly
x += (target_x - x) * 0.1;
y += (target_y - y) * 0.1;
if (mouse_check_button(mb_right))
{
target_x = (obj_player.x+((mouse_x-obj_player.x)/4)) - (view_wview[0]/2.5);
target_y = (obj_player.y+((mouse_y-obj_player.y)/3)) - (view_hview[0]/2);
}
else
{
target_x = (obj_player.x+((mouse_x-obj_player.x)/10)) - (view_wview[0]/2.5);
target_y = (obj_player.y+((mouse_y-obj_player.y)/10)) - (view_hview[0]/2);
}
//Zoom
scr_view_zoom();
//Apply coordinates to view 'x' and 'y'
view_xview[0] = x;
view_yview[0] = y;
///Control View
//Width and Height
view_wview[0] = width;
view_hview[0] = height;
//View Limits (Edges of room)
if (view_xview[0] < 0)
{
out_of_bounds_x = true;
view_xview[0] = 0;
}
else
if (view_xview[0] > room_width - width)
{
out_of_bounds_x = true;
view_xview[0] = room_width - width;
}
else
{
out_of_bounds_x = false;
}
if (view_yview[0] < 0)
{
out_of_bounds_y = true;
view_yview[0] = 0;
}
else
if (view_yview[0] > room_height - height)
{
out_of_bounds_y = true;
view_yview[0] = room_height - height;
}
else
{
out_of_bounds_y = false;
}
(IN END-STEP)
///Follow player smoothly
x += (target_x - x) * 0.1;
y += (target_y - y) * 0.1;
Does anyone know what might be causing this?
Thanks in advance!
Attachments
-
185.6 KB Views: 10
-
35.4 KB Views: 9