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.

Newcomers DBPro Corner / Moving with keyboard, Aiming with mouse

Author
Message
Fneep
19
Years of Service
User Offline
Joined: 3rd Sep 2005
Location: In my house
Posted: 12th Jan 2006 02:58 Edited at: 12th Jan 2006 03:01

Howdy,
First of, I am not asking how to use use the mouse in an FPS setting, I want to know how to work a sprite so that it will rotate to face the cursor. Thanks

TKsFox
18
Years of Service
User Offline
Joined: 25th Nov 2005
Location: No no no - Its not the Cyberspace
Posted: 12th Jan 2006 13:53
There is a tutorial in DBP how to create a simple FPS. Use ur search b4 posting next time.

mousemove x() i think and the y one - dont know exactly.

Uhm - about 2nd q - i dno what u mean...

Sprites r 2D. And the crosshair should be at screen width() / 2, screen height() / 2...

So that isnt a real problem

It's me...
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 12th Jan 2006 15:20
Are you talking about rotating like the spaceship in Asteroids?

In which case, you need to get the angle between the sprite and the mouse...

cos a = x/y

or in code (I think)

angle = acos(x/y)

Fneep
19
Years of Service
User Offline
Joined: 3rd Sep 2005
Location: In my house
Posted: 19th Jan 2006 08:09
TksFox~
Quote: "First of, I am not asking how to use the mouse in an fps setting..."

I mean to move like in that game Crimsonland, http://reflexive.net/index.php?PAGE=game_detail&AID=9

Shadowed Lightning
19
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 19th Jan 2006 08:51
Do you mean like, you click somewhere, and things move to where you clicked?

AMD Athlon 64 3200 - GeForce 6800 GT - 320GB Hard Drive
1024MB RAM
Fneep
19
Years of Service
User Offline
Joined: 3rd Sep 2005
Location: In my house
Posted: 21st Jan 2006 02:13
No. Download crimsonland and look at the way you move the player. Or if your old enough to remember the game abuse, it is also like that. In fact, I think abuse was the first game that had this type of movement.

Login to post a reply

Server time is: 2024-09-24 15:38:08
Your offset time is: 2024-09-24 15:38:08