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.

DarkBASIC Professional Discussion / Distance between two sprites

Author
Message
Alaror
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 22nd Jun 2011 17:13 Edited at: 22nd Jun 2011 17:37
I wasn't able to find any information on this in the forum. How would you check the distance between two sprites? I'd like to check collision before moving the objects to ensure they don't get stuck, but the built in collision system seems to only work after you've moved the object.


Edit: This was a silly post to make... sorry, it's too early All I have to do is compare the X/Y location of each object.
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 22nd Jun 2011 18:51
I've made it a rule for myself to not post any programming questions until after 9 AM.

By then the coffee has kicked in.



Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Jun 2011 04:58
distance = sqrt((x1-x2)^2 + (y1-y2)^2)

Login to post a reply

Server time is: 2026-07-10 14:05:30
Your offset time is: 2026-07-10 14:05:30