Skip to content
/ snake2 Public
Notifications You must be signed in to change notification settings

der1py/snake2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

db55d86 · · Jul 6, 2025

History

5 Commits
Jul 2, 2025
Jul 2, 2025
Jul 6, 2025
Jul 2, 2025
Jul 6, 2025
Jul 2, 2025
Jul 6, 2025
Jul 6, 2025
Jul 2, 2025
Jul 2, 2025

Repository files navigation

Snake2

Snake2 puts a unique spin on the classic Snake game by pitting two players against each other in a fast-paced, competitive duel. Each player controls their own snake, racing to collect food while trying to outmaneuver their opponent.

Features

  • Exciting fast-paced gameplay 🎮
  • Customizable settings ⚙️
  • Fun new gamemode where the snakes have guns 🔫
  • Two players - 2x the fun! 2️⃣
  • Challenging computer-controlled opponent 🤖

Controls

Player 1 Movement: WASD
Player 2 Movement: Arrow Keys

Player 1 Shoot: C
Player 2 Shoot: Comma (,)

Demo

https://der1py.github.io/snake2/

Lessons Learned

👾 Object-Oriented Programming:
I created classes for key game entities like the snake and bullets. This helped organize the code and made it easier to manage interactions between objects..

🧬 Opportunities for Inheritance:
Next time, I can create a base Entity class and have other classes like Snake and Bullet inherit from it, since many functions and properties were repeated across objects.

🖼️ First Time Using HTML Canvas:
I learned how to create a game using the HTML5 as> element. This was my first experience with canvas, and I practiced drawing, animating, and updating game objects.

🔁 Code Reusability:
I often found myself rewriting similar code blocks. In future projects, I’ll use more functions and methods to handle repeated logic and improve maintainability..

🧠 Heuristic AI vs. DFS:
I learned that a heuristic scoring approach works better than depth-first search (DFS) in a game like this. DFS became too complex when evaluating threats like bullets and enemy direction, while simple scoring remained efficient and reliable..

Credits

zeth creations - M9 Beretta sound effects (https://www.youtube.com/watch?v=jAwkr6y1Pjk)
Sound for gunshott

chess.com - capture piece SFX (https://chess.com)
Sound for eating applee

Gaming Sound FX - Bonk - Sound Effect (HD) (https://www.youtube.com/watch?v=ZXK427oXjn8)
Sound for snake head collisionss

W3Schools Game Tutorial - Game Sound (https://www.w3schools.com/graphics/game_sound.asp)
Provided base code for playing sounds in gamee

AI (Claude and ChatGPT) was used for the majority of the CSS, as well as some ideating, debugging, and parts of the README.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published