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.

Dark GDK / Rotate to Point to X Y

Author
Message
RancidRat
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 31st Dec 2008 13:34 Edited at: 31st Dec 2008 13:37
Hi

I know 3d has a point function.
With sprites, how can I figure out the angle to use with dbRotateSprite to make the sprite point towards a 2d coordinate.
I have made a function to do something similar based on the diffrence between the 2 X and Y coords:



This works, but is not perfect since it only covers 16 angles. So what would be a more accurate way to rotate a sprite to a XY coord?

Thank you
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 31st Dec 2008 15:05 Edited at: 31st Dec 2008 15:05


This is from thread near bottom of page 1 (dbsprite:point and move towards another)
check it out.
RancidRat
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 1st Jan 2009 11:06
Thanks, that is the sort of thing I was looking for, I put it in my function:



But the Sprite now turns a completely wrong angle, where did you find that code? Was it a forum post?
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 1st Jan 2009 11:15
Try:



This is from the post:
"dbsprite:point and move towards another"
Near bottom of page.
RancidRat
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 1st Jan 2009 11:52
Thanks alot, that works perfectly

Login to post a reply

Server time is: 2024-11-25 09:21:02
Your offset time is: 2024-11-25 09:21:02