Skip to content

🐍 Expanded Snake Mobile Game Made With Flutter 🐍

License

Notifications You must be signed in to change notification settings

simpson-peter/snek2d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

60 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Snek 2D

This is an open-source game for iOS and Android created by Peter Simpson. It is very similar to the classic Snake, but with a few fun extra features.

Snek Screencap 1 Snek Screencap 2

Design

Snek is implemented in Dart and utilizes the Flutter and Flame frameworks. The top-level logic and coordination of the game is handled by the SnekGameShell, which organizes the game itself, as well as the scoreboard and various menus and alerts.

The game itself is handled by the SnekGame class, which uses a typical update/render game loop, the low-level details of which are handled by flame.

The SnekGame class directs the Board class, which controls the visual rendering process, as well as various classes such as Snake which track the state of the game and handle its logic.

Repository Contents

The majority of the files in this repository are generated by the flutter framework to control app production. The files and directories which are unique to this project are:

  • lib/
  • pubspec.yaml
  • screenshots/
  • README.md (You are here)
  • fonts/ (Fonts are thanks to the Press Start 2P Project Authors and Eduardo Tunni (Graduate)

pubspec.yaml lists the project dependencies, which can be loaded through running a pub get command. screenshots/ contains screenshots of the app in use.

lib/ contains the game source code, and is organized as follows:

  • components/
    • board.dart
      • Contains the Board class, which is responsible for translating the square-tile based logic which the game uses to track positions to pixels, and subsequently render the game.
    • snake.dart
      • Tracks the data relating to the snake position, and handles operations such as adding and removing snake positions
    • snek_game.dart
      • Inherits from the Flame Game class, is composed of almost all of the relevant game data through either direct, or super-compositional ownership, and contains functions to handle game behavior
    • tile.dart
      • Implements the Tile class, which is the atomic unit for all non-visual portions of the game program.
  • util/
    • position.dart
      • Class which tracks data relating to both pixel and row/column positon
    • settings.dart
      • Class which tracks data relating to user choices on special gamemodes
  • widgets/
    • Contains implementations of the various Widgets which comprise the non-game visual elements of the app (scoreboard, settings menu, loss dialog).

Known Issues

None as of now, but as always submit issues or pull requests if you find any!

About

🐍 Expanded Snake Mobile Game Made With Flutter 🐍

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published