Skip to content

AJuna345/snake-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

243 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UNCAFFEINATED - Snake Game

App Title

UNCAFFEINATED - Snake Game

Authorship & Attribution

Game and user interface development by Aiden (A.J.) Ramsden

Resources

Inspirations

  • Classic Snake arcade games
  • Professor Barry Cumbie, Computer Information Systems, University of North Alabama
    • Used class concepts about semantic HTML, validation, accessibility, and responsive web design

Libraries & Frameworks

  • Bootstrap 5.3.0
    • Used Bootstrap for the responsive navbar, cards, modal leaderboard, buttons, table, and layout grid

Assets

  • Google Fonts
  • LocalStorage data for:
    • Player Name
    • Game Difficulty
    • Themes (Classic White, Dark Mode, Neon, and Garfield theme)
    • Leaderboard Scores

One-liner Quote/Tagline

“Now with more snake.”

User Story

User Story

I want to create a classic Snake game with a retro style that will run in a browser. I want to save player names and settings. I want to track player high scores on a leaderboard and remember them between games.

GitHub Links

Model / Inspiration

  • Classic Snake arcade gameplay
    • This project was inspired by simple retro browser and arcade Snake games
    • I used a clean one-page layout with a separate How to Play page, a settings form, and a modal leaderboard to make the game more polished and user-friendly

Wireframes

Wireframe images for Snake Game

Home/Start Gameboard How to Play Leaderboard Game Over

Project Features

  • Playable Snake game with Bootstrap navbar
  • Player Name and Settings
    • Player name validation
    • Theme selector
    • Difficulty selector
  • How to Play page
  • Keyboard controls (up, down, left, right)
  • LocalStorage used to store player settings and leaderboard data
  • Modal leaderboard with a button to clear all scores
  • Accessible status announcements with aria-live
  • Garfield Easter egg theme

Code block + explanation (“game.js” Garfield Easter Egg)

This code adds the Garfield Easter Egg theme when the player enters the name Garfield. It works with the DOM by finding the theme dropdown menu in the page, checking whether a Garfield option is already inside that menu, and creating a new <option> element if it is missing. Then the JavaScript code adds that new option into the dropdown, changes the selected value, updates the <body> class so the page uses the Garfield theme colors, saves that choice in local storage, and redraws everything so the game theme updates immediately. This is a good example of JavaScript changing existing page elements, adding new DOM content, and saving a user setting.

function unlockGarfieldTheme() {
    const themeSelect = document.getElementById('themeSelect');
    let garfieldOption = themeSelect.querySelector('option[value="garfield"]');
    if (!garfieldOption) {
        garfieldOption = document.createElement('option');
        garfieldOption.value = 'garfield';
        garfieldOption.textContent = 'Garfield (Monday Mode)';
        themeSelect.appendChild(garfieldOption);
    }
    themeSelect.value = 'garfield';
    document.body.className = 'theme-garfield';
    saveTheme('garfield');
    setTimeout(() => {
        updateThemeColors();
        if (canvas && ctx) draw();
    }, 50);
}

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors