Blitting fun!
October 31, 2007
Okay, after a battle with getting the character to move around the screen (it seems that my x and y values were criss-crossed in my previous movement attempts) I now have the character successfully moving around the game board and responding to some of the game logic. There are some things I still need to tweak (like testing to make sure the character isn’t moving down a level) but otherwise movement is done.
Then, the next thing I implemented was making it look like the character is actually walking behind taller blocks. This was no easy feat! My first approach at fixing it was to blit the character to the screen, check to see if a taller block was below the character, and then blit the taller block back on top of the character. The only problem with this is that it looks like the block below the character jumps out of the stack of blocks. To fix this I tried re-drawing all of the blocks in the column of the one tall block.
Then, after an hour of frustration, the lightbulb in my head finally went off. Why re-draw the column when all I have to do is blit the board again afterwards? I offset the blitting some, so that it doesn’t remove the character from the board, but otherwise I save resources by not re-drawing all of the blocks in the column so it looks like the character is walking behind a taller block on the map. I’ll have a screenshot up of this later so it makes more sense!
The next thing I have to do is block selection. Fun, fun. Blitting function, you are a BIG BIG help. Thank you allegro
Entry Filed under: Allegro, Code Snippets, Dev, Development, MMORPG, Multiplayer, Online, Programming Languages. .
Trackback this post | Subscribe to the comments via RSS Feed