SOLVED: GetViewportX problem

Started by Slasher, Tue 10/04/2018 14:35:20

Previous topic - Next topic

Slasher

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

//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

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





Khris

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.

SMF spam blocked by CleanTalk