This is a fully functional Love2D Starter Kit with a complete menu system and game framework including:
- Main Menu
- Settings Menu
- Controls Menu
- Playable Snake Game
- Main menu with "Play", "Settings", and "Quit" buttons
- Settings menu with:
- Music volume control
- Effects volume control
- Screen size options
- Language selection (13 supported languages)
- Controls menu with full input customization:
- Keyboard and gamepad support
- Customizable key bindings for all actions
- Reset to defaults option
- Persistent settings using Love2D's save/load system
- State management system
- Reusable UI components (buttons, sliders, dropdowns)
- Classic Snake gameplay with modern enhancements
- Dynamic grid-based movement system
- Collision detection (walls and self-collision)
- Progressive difficulty - game speeds up as you score
- Visual sprite-based graphics for snake segments and fruit
- Sound effects for fruit eating and menu interactions
- Score tracking with real-time display
- Game over detection and restart functionality
- Install Love2D from https://love2d.org/
- Navigate to this project folder in your terminal/command prompt
- Run the command:
love .
main.lua
- Entry point for the Love2D applicationconf.lua
- Configuration settings for the Love2D applicationsrc/
- Source code directorystates/
- Contains all game state implementationsgameState.lua
- Manages game settings and localizationmenuState.lua
- Main menu implementationsettingsState.lua
- Settings menu implementationcontrolsState.lua
- Controls/input settings menuplayState.lua
- Complete Snake game implementation
ui/
- Contains reusable UI componentsbutton.lua
- Reusable button componentslider.lua
- Reusable slider component for volume controlsdropdown.lua
- Reusable dropdown component for selections
utils/
- Utility functions and helpersfontManager.lua
- Font loading and managementlocalization.lua
- Multi-language localization systemsoundManager.lua
- Audio management and playbackinputManager.lua
- Input handling (keyboard/gamepad)json.lua
- JSON parsing utilities
entities/
- Game entities and objects (available for expansion)systems/
- Game systems like physics, audio, etc. (available for expansion)constants/
- Game constants and configurationgameConfig.lua
- Centralized game configuration constants
assets/
- Contains game assetsfonts/
- Font files (including multi-language support)sounds/
- Audio files (menu sounds)music/
- Background music filesimages/
- Game sprites (snake segments, fruit)shaders/
- GLSL shader files (empty - for future use)maps/
- Level and map data (empty - for future use)
The game includes a comprehensive multi-language localization system with support for 13 languages:
- English (
en
) - Default language - 中文 Chinese (
zh
) - Simplified Chinese - हिन्दी Hindi (
hi
) - Hindi - Español Spanish (
es
) - Spanish - Français French (
fr
) - French - العربية Arabic (
ar
) - Arabic (RTL support) - বাংলা Bengali (
bn
) - Bengali - Português Portuguese (
pt
) - Portuguese - Русский Russian (
ru
) - Russian - 日本語 Japanese (
ja
) - Japanese - 한국어 Korean (
ko
) - Korean - Deutsch German (
de
) - German - Polski Polish (
pl
) - Polish
- Complete translations - All UI text is translated for every supported language
- RTL support - Right-to-left text rendering for Arabic
- Dynamic language switching - Change language in settings without restart
- Fallback system - Falls back to English if a translation is missing
- Validation system - Built-in validation to ensure translation completeness
-- Get localized text (uses current language setting)
local playText = gameState.getText("play")
-- Direct access to localization module
local localization = require("src.utils.localization")
local playText = localization.getText("play", "es") -- Spanish
- Add the language code and translations to
src/utils/localization.lua
- Add the language to the
getAvailableLanguages()
function - Use
localization.validateTranslations()
to check completeness
The game includes a comprehensive input management system with full customization support:
- Keyboard - Full QWERTY support with customizable bindings
- Gamepad - Xbox/PlayStation controller support with analog and button inputs
- Hybrid Support - Use keyboard and gamepad simultaneously
- Action-based system - Map multiple keys/buttons to single actions
- Real-time remapping - Change controls without restarting
- Conflict prevention - Prevents duplicate key assignments
- Input validation - Ensures all controls remain functional
- Default restoration - Reset to default bindings option
- Movement: Up, Down, Left, Right (for game and menu navigation)
- Menu: Select, Back (for menu interactions)
- Game: All movement actions work in-game for Snake control
-- Check for action input (handles both keyboard and gamepad)
if inputManager.isActionJustPressed("select") then
-- Handle select action
end
-- Access input manager for custom controls
local inputManager = require("src.utils.inputManager")
The game includes a complete audio management system:
- Music Management - Background music with volume control
- Sound Effects - Menu sounds and game audio feedback
- Volume Control - Separate music and effects volume sliders
- Dynamic Audio - Context-aware music and sound triggering
- Menu background music
- Menu navigation sounds (move, select, back)
- Game sound effects (fruit eating)
All game settings are centralized in src/constants/gameConfig.lua
:
- Screen/Scaling - Virtual canvas and window settings
- Snake Game - Grid size, speed, difficulty progression
- Input - Timing and threshold settings
- Audio - File paths and audio configuration
- Fonts - Font definitions and sizing
- UI - Interface layout and behavior settings
This is now a complete Snake game rather than just a template. To build upon it:
- Add more game modes - Time attack, multiplayer, obstacles
- Power-ups - Special fruits with different effects
- Levels/Maps - Different arena layouts and challenges
- Visual effects - Particles, animations, screen shake
- Advanced scoring - Combo systems, high score tables
- Add more states - Pause menu, high scores, credits
- Create game entities - Use
src/entities/
for game objects - Implement game systems - Use
src/systems/
for physics, particles, etc. - Expand UI components - Add more reusable interface elements
- Add more assets - Sprites, sounds, music, shaders
- Enhance settings - More graphics options, accessibility features
- Save system - Game progress, high scores, achievements
- Networking - Multiplayer support, leaderboards
- Performance - Optimize rendering, add object pooling
- Platform support - Mobile controls, different screen sizes
- Modding support - External content loading, scripting