Rotate a pic

Hey,
In a racing game i’m writing I need to rotate the car sprite. Well, anyone know how to do this?

 Thanks for any help.

Anton.

Hey,
In a racing game i’m writing I need to rotate the car sprite. Well, anyone know how to do this?

The SDL_gfx library has a rotozoom function.

However, remember that rotation is intrinsically pretty slow (compared
to something like scaling).

– JoshOn 12/22/05, antonmasteR wrote:

 Thanks for any help.

Anton.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Alternatively, you can also give you car sprites more frames and create
the different angles for the car on forehand, instead of rotating it
with program code. I think the result will look much better, if this is
a 2D bitmap game!

Best regards
David Karlgren>>Hey,

In a racing game i’m writing I need to rotate the car sprite. Well, anyone know how to do this?

The SDL_gfx library has a rotozoom function.

However, remember that rotation is intrinsically pretty slow (compared
to something like scaling).

– Josh

Do you have any sugestion on how doing this? I’m using a python script
around imagemagick’s convert to append each rotated image so i treat them
like an animation. But unfortunately it doesn’t create fixed sized images,
and if i do using some other convert options, there are some frames that
shrink, make the rotation kinda bizarre. I’m digging every option i have in
imagemagick’s own tools to find alternatives with no luck. Rotating by hand
seems a pain because i have a lot of images to rotate.

Thanks!

ViniciusOn 12/22/05, David K wrote:

Alternatively, you can also give you car sprites more frames and create
the different angles for the car on forehand, instead of rotating it
with program code. I think the result will look much better, if this is
a 2D bitmap game!

Best regards
David Karlgren

Hey,
In a racing game i’m writing I need to rotate the car sprite. Well,
anyone know how to do this?

The SDL_gfx library has a rotozoom function.

However, remember that rotation is intrinsically pretty slow (compared
to something like scaling).

– Josh


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Vinicius Baggio Fuentes
comp05 // turma B
ICMC-USP

Okay, I got something and its working fine. My script is located at
http://grad.icmc.usp.br/~vinibf/create-rotations.py . It’s kinda rubbish but
works. It requires ImageMagick’s convert, maybe version 6+ should do.
The usage is:
./create-rotations.py input_file frame_width frame_height step output_file
the frame dimension is the fixed size frame dimension you want, the step is
the amount of degrees you want to step. (for example, if i do step = 5, then
the program will generate 0, 5, 10, 15… untill 360). Beware that it will
generate a lot of temporary files so make sure you have some extra space.
Beware that im not responsible for any damage, and also it does NOT handle
any errors and i DID NOT TEST it on other machines than my own, just made it
to work as fast as I could. I hope its of any use to you.

PS: I warn you to check the source code before running. It deletes temporary
files, so be careful if your files does not match the file mask rot* and
temp.png, names that im using.

ViniciusOn 12/23/05, Vinicius B. Fuentes <@Vinicius_B_Fuentes> wrote:

Do you have any sugestion on how doing this? I’m using a python script
around imagemagick’s convert to append each rotated image so i treat them
like an animation. But unfortunately it doesn’t create fixed sized images,
and if i do using some other convert options, there are some frames that
shrink, make the rotation kinda bizarre. I’m digging every option i have in
imagemagick’s own tools to find alternatives with no luck. Rotating by hand
seems a pain because i have a lot of images to rotate.

Thanks!

Vinicius

On 12/22/05, David K wrote:

Alternatively, you can also give you car sprites more frames and create
the different angles for the car on forehand, instead of rotating it
with program code. I think the result will look much better, if this is
a 2D bitmap game!

Best regards
David Karlgren

Hey,
In a racing game i’m writing I need to rotate the car sprite. Well,
anyone know how to do this?

The SDL_gfx library has a rotozoom function.

However, remember that rotation is intrinsically pretty slow (compared
to something like scaling).

– Josh


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Vinicius Baggio Fuentes
comp05 // turma B
ICMC-USP


Vinicius Baggio Fuentes
comp05 // turma B
ICMC-USP

Vinicius B. Fuentes wrote:

Do you have any sugestion on how doing this?

The only way I can think of would be in a graphics program like, say,
Photoshop or Paintshop. Select your car sprite and use the
rotate-function in Photoshop (for example). At some angles your sprite
may look distorted, and you may have to correct the pixels by hand. It
is indeed time-consuming if you’re not a graphics artists, but is it
really neccesary to have 360 sprite frames for each angle? Maybe you
could use 90 frames, or perhaps 45 frames? I think it will look quite
smooth anyhow. :slight_smile: Good luck!

Best regards
David Karlgren–
www.terrorpunksyndicate.org
www.myspace.com/terrorpunksyndicate

Vinicius B. Fuentes wrote:

Do you have any sugestion on how doing this?

The only way I can think of would be in a graphics program like, say,
Photoshop or Paintshop. Select your car sprite and use the
rotate-function in Photoshop (for example). At some angles your
sprite may look distorted, and you may have to correct the pixels by
hand. It is indeed time-consuming if you’re not a graphics artists,
but is it really neccesary to have 360 sprite frames for each angle?
Maybe you could use 90 frames, or perhaps 45 frames? I think it will
look quite smooth anyhow. :slight_smile: Good luck!

Depending of the sprite size using 32 frames might be overdoing. So just
first try to rotate a litle bit and then a litle bit more and look if
the frames differ enough to be considered as two different frames.
The next good candidate is 24 frames. Do not use 36, because then you
will miss the 45 degree angle and the sprite can start to woble near
that 45 degree angle.

As a rule of a thumb the amount of frames need to be 8*X to look
correct. The bigger the sprites the higher the X need to be to make
things look good.On Friday 23 December 2005 08:28, David K wrote:

Best regards
David Karlgren

Cool, I noticed that too. And also if I lock to 60fps theres unnoticeable
differences, and by the way, SDL_image doesnt seems to support HUGE images,
it explodes and parachutes are deployed.

ViniciusOn 12/29/05, Sami N??t?nen <sn.ml at bayminer.com> wrote:

On Friday 23 December 2005 08:28, David K wrote:

Vinicius B. Fuentes wrote:

Do you have any sugestion on how doing this?

The only way I can think of would be in a graphics program like, say,
Photoshop or Paintshop. Select your car sprite and use the
rotate-function in Photoshop (for example). At some angles your
sprite may look distorted, and you may have to correct the pixels by
hand. It is indeed time-consuming if you’re not a graphics artists,
but is it really neccesary to have 360 sprite frames for each angle?
Maybe you could use 90 frames, or perhaps 45 frames? I think it will
look quite smooth anyhow. :slight_smile: Good luck!

Depending of the sprite size using 32 frames might be overdoing. So just
first try to rotate a litle bit and then a litle bit more and look if
the frames differ enough to be considered as two different frames.
The next good candidate is 24 frames. Do not use 36, because then you
will miss the 45 degree angle and the sprite can start to woble near
that 45 degree angle.

As a rule of a thumb the amount of frames need to be 8*X to look
correct. The bigger the sprites the higher the X need to be to make
things look good.

Best regards
David Karlgren


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Vinicius Baggio Fuentes
comp05 // turma B
ICMC-USP