Hello! I'm trying to use
SetViewport to manually scroll a room rightwards, but in the room script, as I start typing
set, I get no suggestions related to that function (same for
ReleaseViewport). I've tried running it anyway, but then I get the message:
Undefined token 'SetViewport'. Can someone kindly help me please? Suggestions are also welcome! Thanks in advance! :)
Wrong code:Spoiler
function room_AfterFadeIn()
{
for(int i = 0; i < 240; i++)
{
SetViewport(i, 0);
Wait(1);
}
ReleaseViewport;
}
Correct code:
function room_AfterFadeIn()
{
for(int i = 0; i < 240; i++)
{
Game.Camera.SetAt(i, 0);
Wait(1);
}
Game.Camera.AutoTracking = true;
}
These functions are deprecated in 3.5.0. There's an article in the manual called "Upgrading to AGS 3.5" which explains the changes.
Instead of old Viewport use Game.Camera instead:
https://github.com/adventuregamestudio/ags-manual/wiki/UpgradeTo35#new-viewportcamera-system
Also, if you search for these functions (SetViewport, ReleaseViewport) in the manual, their pages will notify you of which functions to use instead.
Crimson Wizard
Thank you very much! Looks like I've been reading an old version (https://www.adventuregamestudio.co.uk/manual/) of the manual... My bad, sorry! :-[
Quote from: TheNewSon on Tue 28/07/2020 15:11:29
Crimson Wizard
Thank you very much! Looks like I've been reading an old version (https://www.adventuregamestudio.co.uk/manual/) of the manual... My bad, sorry! :-[
Yes, unfortunately that one had not been updated yet.
The wiki pages I've linked above is a "source" from which the manual is now generated.
But you also have an up-to-date manual with your Editor, you can bring it up with F1, or from start up menu too.