Scrolling in 1-person game?

Started by td, Tue 23/05/2006 20:10:39

Previous topic - Next topic

td

Scrolling  in 1-person game is real? I just wanna realize scrolling (as head rotating) when cursor appear on left/right edge...

DoorKnobHandle

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!

td

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

Ashen

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.)
I know what you're thinking ... Don't think that.

td


Candle

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

SMF spam blocked by CleanTalk