bytepath/.vscode/gameobject.code-snippets
2025-11-11 19:21:40 -03:00

45 lines
No EOL
1.6 KiB
Text

{
// Place your learns workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"GameObject Extension": {
"scope": "lua",
"prefix": "extendGameObject",
"body": [
"---@class ${1:ClassName}:GameObject",
"local ${1:ClassName} = GameObject:extend()",
"",
"function ${1:ClassName}:new(area, x, y, opts)",
" ${1:ClassName}.super.new(self, area, x, y, opts)",
"end",
"",
"---Updates ${1:ClassName}",
"---@param dt number delta time",
"function ${1:ClassName}:update(dt)",
" ${1:ClassName}.super.update(self, dt)",
"end",
"",
"---Draws ${1:ClassName}",
"function ${1:ClassName}:draw()",
" ${1:ClassName}.super.draw(self)",
"end",
"",
"return ${1:ClassName}",
""
],
"description": "Extends GameObject with a LuaLS class definition and implements new, update, and draw."
}
}