🐍 Snake Retro Game Shortcode

Snake Retro Game Shortcode by Eskim is a lightweight WordPress plugin that adds a classic Snake game to your site using a simple shortcode.

It’s fast, fully customizable, and requires no external libraries — just HTML5 Canvas and pure JavaScript.

🎮 What It Does

This plugin allows you to embed a retro-style Snake game on any page or post using the shortcode:

[snake_game]

Visitors can control the snake using arrow keys, pause the game with the spacebar, and track their score on-screen. After the game ends, a “Start Game” button appears to restart.

⚙️ How to Use

  1. Install and activate the plugin.
  2. Use the shortcode [snake_game] anywhere in your content.
  3. Optionally, customize the appearance and speed using shortcode attributes.

🔧 Shortcode Attributes

AttributeDescriptionDefault
background_colorBackground color of the game canvas#000
snake_colorColor of the snake segmentslime
food_colorColor of the food blockred
border_colorColor of the canvas border#333
widthWidth of the canvas in pixels300
heightHeight of the canvas in pixels300
speedSnake speed from 1 (slowest) to 100 (fastest)65

Example usage:

[snake_game background_color="#111" snake_color="cyan" food_color="yellow" border_color="#0ff" width="400px" height="400px" speed="75"]

The speed value is mapped to internal delay: 1 = 200ms, 100 = 50ms. Higher number = faster snake.

🕹️ Controls

  • Move: Arrow keys ← ↑ ↓ →
  • Pause / Resume: Spacebar
  • Start: Click “Start Game” button

🧠 Notes

  • The game is best played with a physical keyboard.
  • It works on mobile too, but controls may vary.

☕ Support & Credits

This plugin is free and open-source.
If you like it, consider supporting the author:

👉 Buy Me a Coffee

The Game

Score: 0

Use ← ↑ ↓ → to move, space to pause.