PDA

View Full Version : Sprite Rotation?



EggoH
04-01-2011, 06:25 PM
Hi, first of all I'm new here, so hi everyone!

second of all, I'm needing some quick help, I'm trying to create an asteroids game, I've struggled understanding some step by step guidelines to rotating a sprite I have (which is a seperate class).

I was told to create a member in my sprite called float rotation, and from then on I just get confused!

If anybody is willing to help I'll send you my "attempt" at getting this right.

Thanks, this would be a great help as I am sick of struggling with this!

Andru
05-01-2011, 06:14 AM
Hi and welcome to the PGD!

First of all give us more information - wich engine(or API?) do you use and what kind of problem did you got - rotating the sprite or moving it using new rotating angle? :)

code_glitch
05-01-2011, 05:38 PM
If you want SDL rotation in simple terms then look no further:



Destination_Surface:= rotozoomsurface(Source_Surface, Degrees_Counter_Clockwise, Scale_Factor, Quality_Level);

For the fastest (low quality) rotation set Quality_Level as 0 ;) because it can be a little slow.

Its an sdl_gfx procedureso you would have to


uses
sdl,
sdl_gfx;


Of course that assuming you're using sdl/sdl_gfx. Although if you are looking at creating an asteroids game from step-by-step tutorials and this is your first programming attempt I am working on a project called the Prometheus project - at the moment the only useful units are core and video as audio needs a lot of work but it's aimed at beginners so it has simplicity and some speed in mind ;). Just a suggestion.

EggoH
09-01-2011, 04:15 PM
Thanks for the help even though I stupidly forgot to say what programming language I was using, I was using visual studio 3.0 C#.

I figured out rotation eventually but thanks anyway! :)