love2d-core
What it does
This skill explains how to set up a LÖVE game written in Lua, including its main loop, input and screen changes. It is for people making 2D games with the LÖVE framework.
When to use it
- ✓When you are starting a LÖVE game or setting up its main.lua and conf.lua files.
- ✓When movement in a LÖVE game runs too fast or too slow on different computers.
- ✓When you want to switch between a menu, the game and a pause screen.
Skill link
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/other-engines/love2d-core/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Make my LÖVE game's character move at the same speed on fast and slow computers.”
5 new skills a week. 1 minute to read.
How it works
It explains the load, update and draw functions, uses the time between frames to scale movement, and shows how to handle keyboard input and simple screen switching.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
LÖVE (Love2D) Core
Set up and debug the foundation of a LÖVE game in Lua: the callback loop, frame-rate- independent movement, input, and screen states. Targets LÖVE 11.5.
When to use
- Use when starting a LÖVE game, wiring up
main.lua/conf.lua, or fixing the core loop, movement that runs at the wrong speed, input handling, or screen switching. - Use when the workspace has
main.luacallinglove.*, aconf.lua, or a.lovefile.
When not to use: Lua language questions unrelated to LÖVE; physics bodies/joints
(LÖVE uses Box2D via love.physics — a separate concern); shader code (love.graphics
GLSL is its own topic). For cross-engine save/load patterns, use save-systems.
Core workflow
- Confirm the entry points. A LÖVE game runs
main.lua; it should definelove.load()(one-time setup),love.update(dt)(state), andlove.draw()(rendering). Window/version setup goes inconf.lua(run before modules load). - Pin the version. Set
t.version = "11.5"inconf.luaso LÖVE warns on mismatch. - Drive all motion by
dt(delta time, in seconds) so speed is frame-rate independent. - Handle input two ways: polled (
love.keyboard.isDowninupdate, for held keys) and event (love.keypressedcallback, for discrete presses). - Manage screens (menu, game, pause) with a small state stack rather than a pile of
ifflags — see Patterns andreferences/state-stack.md. - Run and observe. Launch with
love .from the project folder; verify the window, motion speed, and input on screen before assuming it works.
Patterns
1. main.lua skeleton (the callback loop + input)
-- main.lua — LÖVE calls these callbacks for you. Colors are 0–1 in LÖVE 11.x.
function love.load()
-- One-time setup. speed is in PIXELS PER SECOND, not per frame.
player = { x = 100, y = 100, size = 40, speed = 220 }
love.graphics.setBackgroundColor(0.1, 0.1, 0.12)
end
function love.update(dt)
-- Polled input: good for continuous movement while a key is held.
if love.keyboard.isDown("right") then player.x = player.x + player.speed * dt end
if love.keyboard.isDown("left") then player.x = player.x - player.speed * dt end
if love.keyboard.isDown("down") then player.y = player.y + player.speed * dt end
if love.keyboard.isDown("up") then player.y = player.y - player.speed * dt end
end
function love.draw()
love.graphics.setColor(0.2, 0.8, 1.0) -- tint ON
love.graphics.rectangle("fill", player.x, player.y, player.size, player.size)
love.graphics.setColor(1, 1, 1) -- reset tint before text/images
love.graphics.print("Arrow keys to move, Esc to quit", 10, 10)
end
function love.keypressed(key)
-- Event input: fires once per physical press. Use for menus, jumps, toggles.
if key == "escape" then love.event.quit() end
end
2. Frame-rate independence (the single most common bug)
-- RIGHT: scaled by dt → same real-world speed at 30 or 240 FPS.
player.x = player.x + player.speed * dt
-- WRONG: "pixels per frame" → moves twice as fast at double the frame rate.
player.x = player.x + player.speed
3. conf.lua (window + version; runs before main.lua)
-- conf.lua — must be its own file; love.conf will NOT run from main.lua.
function love.conf(t)
t.version = "11.5" -- the LÖVE version this game targets (string "X.Y")
t.window.title = "My LÖVE Game"
t.window.width = 800
t.window.height = 600
t.window.vsync = 1 -- number since 11.0: 1 = on, 0 = off, -1 = adaptive
t.window.resizable = false
t.modules.physics = false -- disable modules you don't use to trim startup/memory
end
4. Color is 0–1 in LÖVE 11.x (not 0–255)
-- LÖVE 11.x uses normalized floats. (Pre-11.0 code used 0–255 and will look wrong.)
love.graphics.setColor(1, 0, 0) -- opaque red
love.graphics.setColor(0.2, 0.8, 1.0, 0.5) -- translucent cyan (alpha 0.5)
-- Need to convert old byte values? Use the helper instead of dividing by hand:
love.graphics.setColor(love.math.colorFromBytes(128, 234, 255))
5. Screen states (brief — full manager in references)
-- A screen is a table with optional :update(dt), :draw(), :keypressed(key).
-- Keep the active screen on a stack so pause/menu overlays are trivial to pop.
local Stack = require("state_stack") -- see re
FAQ
What is LÖVE?
LÖVE, also written Love2D, is a free framework for making 2D games with the Lua language.
Does this cover physics?
Not really. Physics bodies are a separate topic that the skill does not cover.
Which version does this target?
The skill targets LÖVE 11.5 and says to set the version in the configuration file.
Details
Original description by the author
Structure and debug a LÖVE (Love2D) game in Lua: the love.load/update/draw loop, delta-time movement, input, and screen states. Use when building a LÖVE 11.x game (main.lua, conf.lua, .love).
Popularity
- GitHub stars
- 6.6k
- Ranking position
- #13834
- License
- Apache-2.0
- Updated
- 10/28/2026
Comments
- …
More skills from this repository
router
6.6kHelps your agent pick the right game development skill for a request by detecting your engine and the kind of task you need.
ai-behavior-trees-utility-ai
6.6kHelps your agent build a behavior tree and utility AI system for game enemies and characters that choose actions by priority and score.
audio-design
6.6kTeaches your agent game audio mixing: buses, decibel volume, ducking under dialogue, adaptive music and sound effect variation.
camera-systems
6.6kHelps your agent build game cameras that follow smoothly, stay inside the level, and orbit or look around in 3D.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.