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 / How to make a sprite move to point?

Author
Message
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 7th Jan 2007 23:36 Edited at: 7th Jan 2007 23:47
I was wondeing how you get a sprite to move to a point given by the user. for example, in a 2d game, you might have a cross hair that you can move around withe mouse, and when you click, a bullet will come from a spot on you screen. how do you do such a thing?

in other word ( IF you use moe sprite, how do you get the sprite to rotate to the point correctly)


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroup.be/
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 8th Jan 2007 15:27
Here's a basic example I just knocked together:



It's written in DBC - you didn't say which version of DB you were using - and needs more work, but it should point you in the right direction.

Cursor keys move the main sprite and the left mouse button fires.

I should work in DBP but might be a bit fast.

TDK_Man

flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 8th Jan 2007 20:42
ah, im work in dbp, so i guess that work. however, i figured it out. For any one who wants to, search the forums for tank. then find the result with the title being somthing like this, 2d tank chases mouse. Grab the atanfull command from there. youll have to mess with it, but thats were i got my answer.

thanks tdk for responding!


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroup.be/

Login to post a reply

Server time is: 2024-09-25 15:30:30
Your offset time is: 2024-09-25 15:30:30