Page 1 of 1

Rotated sprite question

PostPosted: Sep 20, 2003 @ 6:28am
by Justt
I'm coding a game where I need to blit a time arrow, that is, an arrow sprite that is rotated to display a little clock.

For it to work, the center of the rotation needs to be the bottom edge of the arrow, but I can't get it to work... could anyone give me some help on this simple problem?

Here is the sprite I'm using so you can get a better view of the question:

Image

I've tried looking at the GapiDraw docs but I doesn't give much information on that...

PostPosted: Sep 20, 2003 @ 11:27am
by ppcStudios
Since rotation is easiest if you rotate about the center, make your clock hand sprite twice the current length, with the new half a transparent color. Now the sprite will rotate about the center, and only the non-transparent portion will be visible.

PostPosted: Sep 20, 2003 @ 5:06pm
by Justt
That's what I'm currently doing.
I just thought there may be some better way to do it...

PostPosted: Sep 21, 2003 @ 10:55am
by okku
One method that might work is if you rotate it in the middle and then offset the sprite. The offset is a simple trigonometric formula. Probably something like dx = cos(a)*arrow_length/2, dy = sin(a)*arrow_length/2

/Okku