-
Notifications
You must be signed in to change notification settings - Fork 15
Mode
MrZ_26 edited this page Apr 6, 2024
·
2 revisions
模式文件应当是一个合乎语法的 Lua 程序文件,其必须返回一个 table
。
本项目使用了 Emmylua 语法注释插件,所以一个模式文件推荐以如下方式开头
---@type Techmino.Mode
return {
返回的 table 需要符合预先定义的 Techmino.Mode 类,点击此处跳转到类定义文件,你可能还需要上下翻阅以查看类中包含的其他类的内容。
以下是马拉松的模式文件内容:
---@type Techmino.Mode
return {
initialize=function() -- 模式初始化,创建玩家对象并设置本机控制玩家,播放音乐
GAME.newPlayer(1,'mino')
GAME.setMain(1)
playBgm('propel','base')
end,
settings={mino={ -- 该模式只有一个方块玩家,所以设置里只需要填mino玩法的参数
spawnDelay=130, -- 出块延迟
clearDelay=300, -- 消行延迟
event={ -- 事件
playerInit={ -- 玩家初始化
mechLib.mino.marathon.event_playerInit_auto,
},
afterClear={ -- 消行后
mechLib.mino.music.marathon_afterClear,
mechLib.mino.progress.marathon_afterClear,
},
gameOver=mechLib.mino.progress.marathon_gameOver, -- 游戏结束时
},
}},
result=function()
-- 模式结算
end,
resultPage=function(time)
-- 动画
end,
}