framing the room, that is bigger than the resolution set on game preferences?!?

Started by Filipe, Thu 14/02/2019 13:11:24

Previous topic - Next topic

Filipe

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 :)

Crimson Wizard

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

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);
}

Filipe

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 :)

Filipe

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

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 :)

SMF spam blocked by CleanTalk