Skip to content

ApisMellow/portalsnake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Portal Snake

A terminal-based snake game with Portal-style teleportation mechanics. Navigate your rainbow snake through portals that you place with mouse gestures!

Features

  • Auto-moving snake with dynamic rainbow colors flowing along its body
  • Mouse-controlled portal placement with drag gestures
  • Bidirectional portals - enter either color, exit from the other
  • Animated spinning pellets
  • Classic snake gameplay with a portal twist

Controls

Mouse Controls

  • Left-click and drag: Place blue portal
    • Drag direction sets portal exit direction (up/down/left/right)
  • Right-click and drag: Place red portal
    • Drag direction sets portal exit direction

Keyboard Controls

  • P: Pause/unpause game
  • C: Clear all portals
  • Q or ESC: Quit game

How to Play

  1. Your snake moves automatically in a straight line
  2. Place portals by clicking and dragging in the direction you want the snake to exit
  3. When the snake enters one portal, it exits from the other portal in the direction you specified
  4. Eat pellets to grow your snake and increase your score
  5. Avoid hitting walls or yourself!

Gameplay Tips

  • Plan your portal placements ahead of time
  • Remember: you can only have one red and one blue portal at a time
  • Placing a new portal of the same color replaces the old one
  • Use portals to navigate tight spaces and avoid collisions
  • The snake exits portals in the direction you dragged when placing them

Build & Run

Prerequisites

  • Go 1.21 or higher
  • Terminal with mouse support (most modern terminals)

Build

cd ~/dev/PortalSnake
go build -o portalsnake

Run

./portalsnake

Technical Architecture

Built with a component-based architecture using Go channels:

  • GameCoordinator: Central game state management
  • SnakeEngine: Snake movement and collision detection
  • PortalManager: Portal placement and teleportation logic
  • PelletSpawner: Random pellet generation
  • AnimationEngine: Rainbow and spinning effects (50ms tick)
  • Renderer: Terminal rendering with tcell
  • InputHandler: Mouse and keyboard input processing

Each component runs in its own goroutine, communicating via channels.

Dependencies

  • tcell v2 - Terminal UI and mouse input

License

MIT License - Feel free to use and modify!

About

A game of snake that uses the idea of portals for travel instead of arrow keys

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages