Ok so I went and fixed all the bugs, there were a LOT of bugs. here’s a couple:
- Snake movement and apple generation were happening incorrectly; I use a system where different variables like appleX, appleY, and an array for x and y values of each snake segment are stored as values between 1 and the length of the board (boardDim). They’re then multiplied by the dimension of each cell(cellDim). I initially forgot to multiply by cellDim so the snake was moving at a 1 pixel/second speed and the apple was confined to the top left corner.
- The borders of the cells were not being generated
- I didn’t initialize the arrays that contain the positions for each of the snake’s segments, causing the game to not run at all initially
- Up and down controls were reversed; borders did not work
- If you mash 2 directions, you can crash: e.g. if you’re going up, then mash left and down, the program interprets your down input as the latest one and essentially pushes you into yourself
There are probably some more I haven’t explored yet, but for now I’m gonna work on the main menu.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.