Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: barnacleboy on Sat 05/02/2022 21:37:50

Title: [SOLVED] Make Camera.SetAt pan to the target position, instead of jump to it?
Post by: barnacleboy on Sat 05/02/2022 21:37:50
It seems like camera.setat jumps to the target coordinates, but I'd like it to pan there (as seen in many games, maniac mansion comes to mind).

For example, player enters a room, then the camera pans to a different part of the room to focus on some action.

Any suggestions?
Title: Re: Make Camera.SetAt pan to the target position, instead of jump to it?
Post by: eri0o on Sat 05/02/2022 23:24:41
The easiest way to do this is to use the Tween module.

You can get it here: https://www.adventuregamestudio.co.uk/forums/index.php?topic=57315.0

(It's pinned on the modules forum!)

Using that you should be able to simply tween the camera towards your target.
Title: Re: Make Camera.SetAt pan to the target position, instead of jump to it?
Post by: Crimson Wizard on Sat 05/02/2022 23:30:54
To clarify: what you normally do is save target coordinates in variables, and then move Camera bit by bit until it reaches the saved destination.

For blocking movement you do that in a loop; for non-blocking you have to save coordinates in global variables and move camera in repeatedly_execute (or repeatedly_execute_always).



This is what Tween modules does (and it does many other things too).
Title: Re: Make Camera.SetAt pan to the target position, instead of jump to it?
Post by: barnacleboy on Tue 08/02/2022 21:26:57
Thanks, both approaches work perfectly.