[SDL] Best way to rotate a sprite?
madprog at hotmail.com
Mon Jan 27 16:36:00 PST 2003
>So basically each time I press the left or right arrow key, it will turn
>the graphic 22.5 degrees, and then make it travel along that vector for the
>up/down arrow keys.
i'm workin on a game, and doin basically the same thing you want to do. what
i did was pre-render like 36 or so images of each "ship". then, when the
user presses the left/right keys, i just change the angle the ship is moving
at. then, i my rendering, i just choose which of the 36 bitmaps to draw...
this works good, b/c the ship can be facing in any direction between 0 and
360, down to the precision of float, but the way its gonna show up is one of
36 different pre-rendered pictures... this works real good for me... :-)
M@ the madprogrammer
Protect your PC - get McAfee.com VirusScan Online
More information about the SDL