Skip to content

solarsailengine/snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game for SolarSail

A classic snake game implementation demonstrating SolarSail's entity management and grid-based gameplay.

Snake Game

How to Play

  • Arrow Keys or WASD: Change snake direction
  • R: Restart game after game over
  • Q: Quit game

Game Rules

  • Control the snake to eat red food squares
  • Each food eaten increases your score by 10 points
  • The snake grows longer with each food eaten
  • The game speeds up as you eat more food
  • Game ends if you hit the walls or yourself

Technical Features

  • Grid-based movement (30x20 cells)
  • Dynamic entity creation/destruction for snake segments
  • Sprite atlas with snake and food sprites
  • Collision detection for walls, self, and food
  • Speed increase mechanic
  • Score tracking

Implementation Details

  • game_controller.lua: Main game logic

    • Snake movement and growth
    • Food spawning
    • Collision detection
    • Input handling via message broadcasting
  • config.lua: Game configuration

    • Grid dimensions
    • Speed settings
    • Visual parameters
  • Coordinate System:

    • Grid coordinates (0,0) to (29,19)
    • Converted to world coordinates with center origin

Running

cd /home/dagostinelli/projects/solarsail/snake
make run

Key Learnings Applied

  • Center-origin coordinate system
  • Entity component system for dynamic objects
  • Message broadcasting for input handling
  • Transform manipulation for movement
  • Sprite atlas for visual assets

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published