iiitl / snake-game-js

0 stars 43 forks source link

Enhanced Mobile Compatibility and controls. Solved issue #6 #20

Closed AshwinGajbhiye closed 5 months ago

AshwinGajbhiye commented 5 months ago

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

After that in css file i have decorated the buttons and have set their position in the bottom left corner for easy access image

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. image

the final image of the game is given below:-- image

ANKITy102 commented 5 months ago

@AshwinGajbhiye, show button in mobile view rather than in desktop view.