Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Filipe on Thu 14/02/2019 13:11:24

Title: framing the room, that is bigger than the resolution set on game preferences?!?
Post by: Filipe on Thu 14/02/2019 13:11:24
Hi there again,

If the room is bigger than the resolution I set in the preferences, how can I tell AGS  which part of this bigger romm should it shows? Right now he is showing the center of the room, where I put my character, but he is also cutting my character's head. Is there away to frame it right?

I hope you understand what I mean :(

Thanks :)
Title: Re: framing the room, that is bigger than the resolution set on game preferences?!?
Post by: Crimson Wizard on Thu 14/02/2019 13:30:57
If you are not satisfied with default camera controls SetViewport command is used to manually control what part of room is shown. You may want to put this command in function called "late_repeatedly_execute_always", this function is called after character movement but before game is drawn.

For example:
Code (ags) Select

function late_repeatedly_execute_always()
{
    int extra_y_offset = 100; // an example of adjusting vertical position
    // SetViewport demands coordinates of top-left corner of the "camera" inside the room
    // following command sets viewport centered on player by x and with certain offset by y
    SetViewport(player.x - System.ViewportWidth / 2, player.y - System.ViewportHeight / 2 - extra_y_offset);
}
Title: Re: framing the room, that is bigger than the resolution set on game preferences?!?
Post by: Filipe on Thu 14/02/2019 23:59:22
Thanks... I'm gonna try it . I want the camera to show more of the above part of the screen and less of the bottom. Now he is showing somewhere in the middle, and it is cuttig my character's neck and head...  Again thanks :)
Title: Re: framing the room, that is bigger than the resolution set on game preferences?!?
Post by: Filipe on Sun 17/02/2019 19:17:44
Quote from: Crimson Wizard on Thu 14/02/2019 13:30:57
If you are not satisfied with default camera controls SetViewport command is used to manually control what part of room is shown. You may want to put this command in function called "late_repeatedly_execute_always", this function is called after character movement but before game is drawn.

For example:
Code (ags) Select

function late_repeatedly_execute_always()
{
    int extra_y_offset = 100; // an example of adjusting vertical position
    // SetViewport demands coordinates of top-left corner of the "camera" inside the room
    // following command sets viewport centered on player by x and with certain offset by y
    SetViewport(player.x - System.ViewportWidth / 2, player.y - System.ViewportHeight / 2 - extra_y_offset);
}


Thank you Crimson Wizard. It worked fine :) I'm so happy, I have you guys support... You are awesome :)

Thanks :)