Caching sprite roation on load?
Hey everyone,
I am developing a 2D racing game similar to the Micro Machines games from a few years ago, and I need a bit of help.
I am developing it in SDL, and what I want to do is for each vehicle have 1 bitmap for the sprite (to save on resources). The sprite will always face up the screen, but obviously for turning I need to rotate the bitmap. So far, everything leads to my best bet being taking the bitmap at loadtime, doing 16 roation calculations of 22.5 degrees each (16 directions) and cacheing these for using in game.
The control method is simple, similar to Grand Theft Auto. The up & down arrows will make the car travel along the vector it is facing, while the left & right arrows will turn the vehicle in the desired direction left or right by 22.5-degrees, so every time either left or right is pressed, I need to load the cached image for that angle and display it, so the car will travel along that direction.
What is the best way to generate and cache these graphics? IS this really the best method? I don''t see anything in SDL that allows me to roate the sprite in real-time, and I am doing it in software (so it can run on min specs, no graphics card needed), so I have been told this is expensive on the system. I''ve tried looking on a few sites, and even on google but not come up with much.
Can anyone help? Thanks!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement