Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: td on Tue 23/05/2006 20:10:39

Title: Scrolling in 1-person game?
Post by: td on Tue 23/05/2006 20:10:39
Scrolling  in 1-person game is real? I just wanna realize scrolling (as head rotating) when cursor appear on left/right edge...
Title: Re: Scrolling in 1-person game?
Post by: DoorKnobHandle on Tue 23/05/2006 20:19:22
I suppose you mean firstperson-perspective-game? :=

Use "SetViewport ( int X, int Y );" to move the part of the room that you can currently view on the screen around (you'll also need to use variables to keep track of the x- and y-values). Then, change those x- and-coordinates when the mouse is on the left or right edge of the screen (check this in your repeatedly_execute function of the scrolling room(s) that you have, by using if-conditions and "mouse.x" / "mouse.y" to get the coordinates of the mouse position). You want to decrease your x-variable when the mouse is close to the left screen edge and increase the x-value when it is close to the right screen edge. Increase or decrease by a set amount (for example 2 pixels or 4 pixels) to control the scrolling speed (don't make it too fast and don't make it too slow obviously / or (even better) allow the player to adjust that speed by using a GUI slider) or you could even calculate how close the mouse is to the respective screen edge and let this value determine the scrolling speed (doing so will result in "smooth scrolling" and allow the user to move the mouse close to the right edge for example and the game will start to scroll slowly and if the player moves the mouse then over more to the edge and gets closer and closer, the game will scroll faster.

I don't have the time right now to go into real detail, sorry. Maybe somebody else could help you here with the right code snippets etc., but that's exactly what I'd probably do to realize this effect!
Title: Re: Scrolling in 1-person game?
Post by: td on Tue 23/05/2006 20:37:49
Wah! It is not so easy like i supposed! In 3 - person game scrolling is auto... Maybe scrolling in 1-person game is not necessarily?
How u think all???
Title: Re: Scrolling in 1-person game?
Post by: Ashen on Tue 23/05/2006 20:45:36
Do a forum search for 'Panoramic Scrolling'. This has been asked and answered a few times before - I've even knocked together a module for it. (It hasn't been 'officially' released, but it's around - the search should find it.)
Title: Re: Scrolling in 1-person game?
Post by: td on Tue 23/05/2006 20:54:59
thanks
Title: Re: Scrolling in 1-person game?
Post by: Candle on Tue 23/05/2006 22:02:06
Quote from: Ashen on Tue 23/05/2006 20:45:36
Do a forum search for 'Panoramic Scrolling'. This has been asked and answered a few times before - I've even knocked together a module for it. (It hasn't been 'officially' released, but it's around - the search should find it.)

Boss module it is too.
You do nice stuff Ashen ............