In the body tag i have added four buttons to control the snake
After that in css file i have decorated the buttons and have set their position in the bottom left corner for easy access
And I have added the javascript which is playing the main role . In which first I have created four constants for each of the four buttons . After that i have added the addEventListner function for each of the buttons which after being clicked calls back to the
inputDir function which sets the direction of the snake on the basis of the button clicked and the value of x and y respectively.
6 -->
This is resolved by using HTML,CSS AND JAVASCRIPT
In the body tag i have added four buttons to control the snake![Screenshot 2024-03-15 120356](https://github.com/iiitl/snake-game-js/assets/143488161/bf2a9dbf-18a1-4b9e-b54b-d7aa3d46be20)
After that in css file i have decorated the buttons and have set their position in the bottom left corner for easy access![image](https://github.com/iiitl/snake-game-js/assets/143488161/13f3b91b-33f8-4c40-ae10-ac266e010e3d)
And I have added the javascript which is playing the main role . In which first I have created four constants for each of the four buttons . After that i have added the addEventListner function for each of the buttons which after being clicked calls back to the![image](https://github.com/iiitl/snake-game-js/assets/143488161/b47f08cc-8b74-4aa8-b08a-cbeb44e8463c)
inputDir function which sets the direction of the snake on the basis of the button clicked and the value of x and y respectively.
the final image of the game is given below:--![image](https://github.com/iiitl/snake-game-js/assets/143488161/85dddfe2-e952-4dd0-8b3a-16b6c179b770)