How aryallaxman99/snake-game works
This repository combines a browser-based Snake game with a small PHP account system backed by MySQL. The main play workflow is keyboard input into the JavaScript game loop, which updates the snake, food, score, and game-over display. Users can also sign up, log in, and log out. The excerpts show the PHP database and helper calls, but do not show how the game page loads its script or whether gameplay checks the login session; those links are therefore omitted.
Main entry points: signup.php Sign up · login.php Login · snake.js Game loop · connection.php DB connection
Components 13
Account system
- Login
login.php - Sign up
signup.php - Log out
logout.php - Account helpers
function.php - DB connection
connection.php - User database
- Account styling
login_style.css
Snake gameplay
- Game page
snake/game.html - Game loop
snake/snake.js - Game styling
snake/style.css
Game assets
- Sound effects
snake/audio - Game images
snake/image
Other components
- Player
Connections 13
- Player → Login: submits credentials
login.php - Player → Sign up: submits details
signup.php - Player → Log out: requests logout
logout.php - Login → DB connection: includes
login.php - Sign up → DB connection: includes
signup.php - Sign up → Account helpers: generates ID
signup.php - Login → User database: queries user
login.php - Sign up → User database: inserts user
signup.php - Account helpers → User database: looks up session user
function.php - DB connection → User database: connects
connection.php - Player → Game loop: uses arrow keys
README.md - Game loop → Sound effects: plays effects
snake/snake.js - Game loop → Game images: loads images
snake/snake.js