🐍 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
- Install and activate the plugin.
- Use the shortcode
[snake_game]anywhere in your content. - Optionally, customize the appearance and speed using shortcode attributes.
🔧 Shortcode Attributes
| Attribute | Description | Default |
|---|---|---|
background_color | Background color of the game canvas | #000 |
snake_color | Color of the snake segments | lime |
food_color | Color of the food block | red |
border_color | Color of the canvas border | #333 |
width | Width of the canvas in pixels | 300 |
height | Height of the canvas in pixels | 300 |
speed | Snake 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
speedvalue 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:
The Game
Use ← ↑ ↓ → to move, space to pause.
