Hey guys, all Oz references aside, I got a question. Basically, I have a game (using Allegro), and its coming along very nicely, I have a map, tiles, enemies, textures and the lot, but I notice that the lag tends to spike at what (seems like) random. I'll get to why I think its lagging later, but I should probably go over the whole things for the sake of completeness. Every cycle (tick, whatever you want to call it), the game draws all the tiles (including water and lava, which are animated with 2 frames), runs the enemy through its AI once, then draws the player and the enemy (both use the same animation technique). All the tiles store a pointer to their image (and a second one in case they're animated), and are in turn stored in a room object. Now,I think the player object is particularly ugly and lag prone because of its animation function. it uses an if statement to check if there is an animation started, then another if statement for each direction the player could be facing (NESW), then a switch for what frame to draw. The switch uses an integer that gets advanced with each tick, and reset to 0 when a new animation is started. There's also some other switches for standing still etc. Is it the amount of if/switch statements slowing it down? or is it something else I'm not aware of.
I hope that makes sense.