love2dcore
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "love2dcore":https://skillpi.com/zh/skills/deepskill-d033b3ae3b4b8b3b6eb4caca099395948aedfe05c68c5f7ad8e4af2177d03890。安装前核对上游来源和版本:https://skillhub.cn/skills/user_3c6cb52e/love2d-core-3ypv。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
skillhub.cn
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
Love2dCore 专用技能,帮助 AI Agent 高效完成与 Love2dCore 相关的任务。
介绍来源: third_party · user_3c6cb52e · 1.0.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 适合谁
- 翻译待完成,请参阅来源文档。
- 输入和输出
- 来源文档未说明。
- 软件、账号及付费要求
- 来源文档未说明。
- 限制与区别
- 来源文档未说明。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: Love2dcore
slug: love2d-core
version: 1.0.0
displayName: Love2dcore
description: >
Love2dCore专用技能,帮助AI Agent高效完成相关任务。
summary: "Love2dCore专用技能,帮助AI Agent高效完成相关任务。"
license: Apache-2.0
category: 游戏开发
framework:
- Claude Code
- Codex
- Hermes Agent
- OpenClaw
- QClaw
- WorkBuddy
platform: multi-platform
homepage: https://github.com/1991513ccie-png
repository: https://github.com/1991513ccie-pngLÖ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 references/state-stack.md for the module
function love.load() Stack.push(require("screens.menu")) end
function love.update(dt) Stack.current():update(dt) end
function love.draw() Stack.current():draw() end
function love.keypressed(key) Stack.current():keypressed(key) end
Pitfalls
- Speed varies with FPS → you forgot
* dt. Every per-frame change to position, timers, or animation must be scaled bydt. love.confplaced inmain.lua→ it silently does nothing. It must live inconf.lua, which LÖVE runs before loading modules.- Colors washed out or invisible → you used 0–255 values. In 11.x,
setColor(255,0,0)clamps to white; usesetColor(1,0,0)orlove.math.colorFromBytes. - Everything tinted after one
setColor→ color is global and persists across draws. Reset withlove.graphics.setColor(1, 1, 1)before drawing text/images you want untinted. - Nothing happens on key release/repeat →
love.keypressed(key, scancode, isrepeat)fires on press (and OS key-repeat); uselove.keyreleasedfor release, and checkisrepeatif you must ignore held-key repeats.
References
- For a complete push/pop screen-state manager (menu → game → pause, with delegated
callbacks), read
references/state-stack.md.
Related skills
save-systems— saving/loading game state (engine-agnostic).input-systems— rebindable, multi-device input architecture.pygame-core/phaser-core— the same loop concepts in other lightweight engines.
当前收录版本
1.0.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 针对 LÖVE 游戏开发的核心痛点(帧率独立运动、输入处理、屏幕状态管理)提供实用解决方案
- 覆盖广泛受众的通用工具场景,适合游戏开发初学者和中级开发者
待提升项
-
触发词描述不够结构化 原报告严重程度:轻微
触发条件描述较为分散,未集中列出明确的关键词或短语列表
改进建议:建议在 frontmatter 或独立章节中明确列出触发关键词,如 'main.lua', 'conf.lua', 'love.load', 'love.update', 'dt', 'frame-rate independent'
亮点
- 触发边界清晰,能有效区分 LÖVE 相关任务与其他 Lua 任务
待提升项
-
When to Use 章节标题格式不规范 原报告严重程度:轻微
实际内容存在但使用了普通段落而非标准章节标题格式
改进建议:建议将 'When to use' 改为标准 Markdown 二级标题 '## When to Use' 以保持结构一致性
亮点
- 核心工作流程分步骤清晰,包含端到端代码示例
- frontmatter 完整,包含必要的元数据信息
亮点
- 明确指定 LÖVE 11.5 版本,避免兼容性问题
- 覆盖常见陷阱(如 dt 使用、颜色范围、conf.lua 位置)并提供解决方案
- 提供可立即运行的代码示例和最佳实践
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- github.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
来源文档未说明。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。