Devlog #1.6: Sights on the Peak!
Hey everyone! Welcome back to another devlog. Today, we are one giant step forward in finishing the game engine: tilemaps and animations.
Tilemaps:
The whole level is a grid of letters. I draw my maps as plain text: W is a wall, C is a coin, ’. ‘is empty space (These are just the examples that I’m using for the demos). So a level is literally a block of text I type out, like ASCII art of the room. The engine turns each letter into a tile. It walks the grid square by square, and for each letter it looks up a matching 8×8 picture and stamps it at that spot. A ‘W’ becomes a wall tile, a ’. ‘draw nothing. This is all easy on paper but when actually trying to create it, it was hell. The amount of bugs that would come wouldn’t stop and I actually was very close to giving up for the day. But, I persisted, and after over 20+ Google Tabs, I was able to work it out.
Animations:
Even though I thought this would be the hardest thing to implement, this one was the easiest feature to implement imo. It’s a flipbook of sprites. A walk animation is just a list of frames, the same little pixel sprites I already made. Flip through them fast and the legs look like they’re moving. A timer controls the speed. If I swapped frames every single frame of the game (60 times a second) it’d be a blur, so I count ticks and only switch to the next frame every few ticks. That one number tunes how fast the walk looks. When it reaches the last frame it loops back to the first, so it cycles forever. It only animates when it should. While you hold an arrow, I advance the frames so the hero walks.
When you let go, I reset to the standing pose so he doesn’t moonwalk in place.
What’s Next?
This engine is veryyy close to being finished! I just need to add sounds and this engine should be complete! After I finish the engine, I will ship the engine. See you next time!
Also, if you want to know what the tilemap in the demo looks like in code, here it is:
LEVEL = [
"WWWWWWWWWWWWWWWW",
"W...........................................................W",
"W.................WWW.......................C....W",
"W............................................WWW..W",
"W..C......................................................W",
"W.......................WW...........................W",
"W.....................WW............C...............W",
"W..........................................................W",
"W..................WWWW........................W",
"W.............................C...........................W",
"W.............................C...........................W",
"W.........................WWWW.................W",
"W..........................................................W",
"W........................C...............C..............W",
"W..........................................................W",
"WWWWWWWWWWWWWWWW", ] ```
The formatting is messed up as the original is in Python, but I hope you get the gist!
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.