Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: AndreasBlack on Sun 13/03/2022 11:12:21

Title: Trouble getting the Tween at the right viewport at the start
Post by: AndreasBlack on Sun 13/03/2022 11:12:21
The screen should be positioned "differently" then the imported bakgroundscreen at the start, so i thought Room Load would be the correct place to put it.

However all i can seem to do is when the room shows up it adjusts itself to the right screen positioning, but it should happen before the fade in so you don't see it adjusting. I can't set it to 0.0, then i get a crash.

So how could i get the same result without a crash? Thanks!


Code (ags) Select
function room_Load()

{

Screen.Viewport.TweenX(0.1, 200, eEaseInSineTween, eNoBlockTween);
Screen.Viewport.TweenY(0.1, 100, eEaseInSineTween, eNoBlockTween);

}



Title: Re: Trouble getting the Tween at the right viewport at the start
Post by: Matti on Sun 13/03/2022 11:56:42
Why are you using Tween if you don't want to see the tweening? You could just set the Viewport/Camera directly.
Title: Re: Trouble getting the Tween at the right viewport at the start
Post by: AndreasBlack on Sun 13/03/2022 12:50:33
Quote from: Matti on Sun 13/03/2022 11:56:42
Why are you using Tween if you don't want to see the tweening? You could just set the Viewport/Camera directly.

Give an example, i'm looking in the manual, can't find it.

  Game.Camera.SetPosition (640, 395); ??? Something like that?

.........................Why does something that seems so basic end up being so complicated (laugh)
EDIT:

Solution example for those who don't know themselfs such basic thing.

Code (ags) Select
  Game.Camera.SetAt(380, 140);

The right "values". I was taking the values to extreme settings and nothing happened, i have no idea why, but now it's working