posted 4 months ago
I am making a game which develops on top of the original Snake game. The problem is that when the user snake hits a purple apple or the wall or it's own snake body, the game ends. To restart the game, I have initialized the user to press SPACE in order to restart and it is not responding on press. This was working before I made changes to the drawWalls() method but I have tried backtracking to the source of the bug but I have had no luck so far. I know I should be using KeyBindings instead of KeyListener but I need to specifically use KeyListener for this project. Any help will be appreciated. Also if an MCVE needs to be created I would like advice on how to condense this to do so.
I have also provided images of both in game and when the user needs to press SPACE to restart to where it will navigate to. I have taken out some code to attempt to simplify the post.
Code:
gameProcess.JPG