Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Tue 10/04/2018 14:35:20

Title: SOLVED: GetViewportX problem
Post by: Slasher on Tue 10/04/2018 14:35:20
Hi

I have come across a situation.

I have a scrolling room 2028 x 768 (Res is 1024 x 768).

There are two doorways, one at each end.

However, GetViewportX is not showing as it should...

I am using:

Code (ags) Select

//Room Load
cJonesP.x=58 +GetViewportX();

//And calling in room and player is not showing where he should be at the top left.
cJonesP.SayAt(50, 0, 1000, "I have a sneaking suspicion I may not be alone.");


cheers

Edit:

Of course this works:

Code (ags) Select

function repeatedly_execute_always()
{
  cJonesP.x=58 +GetViewportX();
 
}




Title: Re: SOLVED: GetViewportX problem
Post by: Khris on Wed 11/04/2018 09:56:21
The initial viewport coordinates depend on where the player character starts out in the room.
For a 1024 pixels wide game, viewportX is basically player.x - 512, with a minimum of 0 and a maximum of Room.Width - System.ViewportWidth.

I have no idea what you issue is, since I cannot translate "GetViewportX is not showing as it should" into anything meaningful.

Is cJonesP your player character? To which x coordinate are you sending them when you load the room? What do you expect to happen? What's happening instead? And so on. You know the drill.