Retro Snakes
A downloadable game
Game repo: https://github.com/marko-jovanovic/godot-retro-snakes
What was the challenge during the process of making it?
Challenge 1: Snake body
Well at the beginning I thought: "oh, the snake should take care of itself! No other object should be able to add to the body of a snake except snake!", and you know what? Even though it's true, it cannot be done like that. That's because every child of a snake will move wherever the parent moves away and we don't want that...We want each body part to follow the previous position of the snake's head.
Solution: I've put that logic in the main scene and the body parts were not the child nodes of snake anymore, they were put child nodes of the main scene. Challenge 2: Snake dash
I didn't want to bother with different resolutions, so the board I've made was pretty huge, so I introduced dash! The problem with dash is that you have to keep track of previous speed so when dash expires you start to move normally again or whenever you release the spacebar. To get things more complicated I had to update UI so the player can see how much he can dash. Who's responsibility is that? Emit another signal?
Solution: Well, I actually did that, I've made a signal called DashUpdate, maybe it's not clever much but I'm on my way of learning.
Challenge 3: Game Over
I had a problem with removing everything from the board after the player dies, but more precisely these are: food and special food. Why? Because they are dynamically created, thus, they are getting an auto-assigned name. You'll say "but you can assign it yourself!", and that's correct, BUT! The problem is that when a snake eats food, the food is queued to be freed and I emit a signal that food had been eaten, so I start initializing another food. It seems that the engine, while initializing new food, still has old food in the background (because it's queued to be deleted) and thus it auto-assigns name.
Solution: I solved this problem in a hacky way: I've put food in their own groups, and upon end, I simply called a method Destroy on all groups to delete them, where I simply QueueFree()
If you have any questions, please leave the question in comments.
Status | In development |
Author | munkitsune |
Genre | Action |
Made with | Godot |
Tags | 2D, Retro |
Code license | MIT License |
Average session | A few minutes |
Languages | English |
Inputs | Keyboard |
Download
Install instructions
Unzip the archive into some folder and don't move fiels anywhere, just start the game.
Leave a comment
Log in with itch.io to leave a comment.