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.

2D All the way! / 2D rotation problem...

Manuel v2
Years of Service
User Offline
Joined: 7th May 2011
Posted: 23rd May 2011 01:03
I'm making a simple arrow sprite to follow the mouse and always point at it.
I fail...
The Sprite never gets rotated the right way!

I'v made my own funcions "vec A (0,0)" , "todeg" and "angle" that gives the vector angle relative to X-axis in radians.
They'r very simple and seem to been working so far: I dont think that is the problem.

The Coordinates are a bit different in Dark GDK, point 0,0 is at the left top instead of left bottom and I think that is what's causing the issue... I'v tryed adding, subtrating 90 180 270 from Ang, -Ang and a combination. None seems to work!

Can anyone help me get the right rotation angle offset?
Grog Grueslayer
Valued Member
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 26th May 2011 06:08
I'm not sure what the command is called in DarkGDK but if you use ATANFULL (probably DBATANFULL) you can get the angle between two points. I generally use WRAPVALUE also to add another "just in case something horrible happens" and ATANFULL throws out a number that isn't between 0 and 360.

Here it is in Darkbasic Pro:

Login to post a reply

Server time is: 2024-02-29 08:39:46
Your offset time is: 2024-02-29 08:39:46