Grid based snake game featuring dynamic directional sprites and difficulty settings
I began by forming the logic to create a game tick and draw the grid. Next, I randomly assigned the “food” and rendered the snake to the grid. This was fairly straight forward due to the amount of brainstorming and planning I did before writing any code. At first, the snake was merely a color-filled grid tile followed by other color-filled grid tiles acting as its tail. I knew this was not the end result, so I started planning how to implement sprites into my game. This was the most difficult code I've had to write while working with game-style code. But man, it was so fun and rewarding. It involved writing a function to check the snake’s head position and which direction it was facing on the grid. Another function checked the tail pieces’ previous and subsequent position and direction in order to render the correct sprite for a specific piece. The complexity of rendering corner pieces revealed to be pretty difficult. While I spend time finishing this feature, the game may look unfinished but continues to serve as a reminder of how far my skills have come.
- Learned a lot about game loops and what goes on behind the scenes