Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Lewis on Thu 05/10/2017 07:12:16

Title: SOLVED- 'Camera inverting' - Defining player position on room change
Post by: Lewis on Thu 05/10/2017 07:12:16
I have a scene where the player can cross the road and the "camera" switches position to show a different angle on the area. This is set up as two separate rooms, each of which has a wide, scrolling background and the player can exit the room at any point of the lower edge, and should then appear at the appropriate location in the new room.

(https://media.giphy.com/media/xUNd9UtzVdetwviF7a/giphy.gif)

I'm trying to figure out a neater way of defining the player's position and direction when switching between these rooms.

Right now I split the 'camera switch' area into multiple hotspots and hand-script where the player should walk to before the room transition, and how they should be oriented in the new room.

But it's not ideal: the player doesn't always walk to exactly where they've clicked, and there's an awful lot of hand-scripted stuff there that feels as though it could be made redundant.

I can't just check the player's x position and replicate it in the new room because the 'camera' is facing in a different direction, so the positioning and scaling are out.

Suspect I'm missing an easy trick here but over to the board!
Title: Re: 'Camera inverting' - Defining player position on room change when crossing road
Post by: Khris on Thu 05/10/2017 09:18:26
Quote from: Lewis on Thu 05/10/2017 07:12:16I can't just check the player's x position and replicate it in the new room because the 'camera' is facing in a different direction, so the positioning and scaling are out.
If the camera view changes by 180 degrees, the new position is basically Room.Width - player.x
If the camera change is more complicated, the math becomes more complicated, too.
Title: Re: 'Camera inverting' - Defining player position on room change when crossing road
Post by: Lewis on Thu 05/10/2017 14:00:16
Bingo. Khris to the rescue as always. And, as always, a much simpler solution than I was convoluting it to be!