Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Professional RTS Camera Movement

Author
Message
Lazlazlaz 1
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location: England
Posted: 27th Apr 2006 19:47
I posted this on the codebase, but i thought i would post it here too to get some feedback.

Quote: "
RTS Camera Movement - This camera control system functions like in any professional RTS game. You move the mouse close to the edge and the screen moves, move it closer and the screen moves faster. It also allows for different speeds and angles for the camera
Full Description

This code works by seeing if the mouse is close to the edge (within two different distances) this is worked out as a value relative to the screen width and height. Left and right movement is simple enough using the move camera left/right commands.
Moving the camera forward/backward and maintain the angle the camera faces down can be done easily without any vector work. You just angle the camera to face directly forward as is default (angle camera 0), move it the required speed, then angle it back to the original angle."


Hmm
Gen
20
Years of Service
User Offline
Joined: 6th Jul 2004
Location: Oklahoma, USA
Posted: 27th Apr 2006 20:56
Use
instead

Windows XP Pro Service Pack 2, Pentium 4 2.4 GHz, 768 MB PC3200 Ram, ATI Radeon X700 Pro 256 MB
Dark Basic Professional 5.9 Dark IDE nearly complete!
Lazlazlaz 1
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location: England
Posted: 27th Apr 2006 22:28
well for some reason it wont let me edit the last post (says unknown system error.sorry i have to abort now). so this the code:



Hmm
Gen
20
Years of Service
User Offline
Joined: 6th Jul 2004
Location: Oklahoma, USA
Posted: 30th Apr 2006 07:18
The exact same wy I was doing it, except I didn't have the fast or slow depending on the distance from the edge of the screen.

Looks nice

Windows XP Pro Service Pack 2, Pentium 4 2.4 GHz, 768 MB PC3200 Ram, ATI Radeon X700 Pro 256 MB
Dark Basic Professional 5.9 Dark IDE nearly complete!
Lazlazlaz 1
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location: England
Posted: 1st May 2006 23:11
thanks

Hmm
Doctor Duddits
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location:
Posted: 24th May 2006 15:43
too complicate for a simple mind like me

Same Shit Different Day
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th May 2006 19:10
So basically, it looks like the camera will constantly be moving? Not sure why you're dividing everything like that.

Here's a way to get a more variable speed rather than just slow or fast.



"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike

Login to post a reply

Server time is: 2024-11-23 03:13:20
Your offset time is: 2024-11-23 03:13:20