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 / DB Pro - Snake that follows the mouse

Author
Message
_ RealUnReal _
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Dudley, UK
Posted: 15th Jan 2006 21:10
This program works well and has plenty of room for enhancment, project folder available from the download button.


Also can my two maths functions be made better, thanks.

Attachments

Login to view attachments
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 15th Jan 2006 21:23
To get the angle between 2 points, use atanfull(xdiff,ydiff).

And to get the distance, I suggest you use vectors(2D).

r = make vector2(1) creates a vector 1
set vector2 1,5,4 sets the vector to 5 width and 4 height
dist# = length vector2(1) gets the length of the vector
(This only works in DBP)

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
_ RealUnReal _
19
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Dudley, UK
Posted: 16th Jan 2006 12:33
Ok

I have changed the new angle function using the atanfull function and now my snake moves away from the mouse.



Can someone please show me how to use the result properly.

Thanks.

Login to post a reply

Server time is: 2024-11-23 07:27:52
Your offset time is: 2024-11-23 07:27:52