1 Star 0 Fork 0

alexzshl/hlua-helloworld

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.lua 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
hunzsig 提交于 2022-05-29 20:30 +08:00 . chore(*): 调整演示
--- Generated by h-lua(https://github.com/h-lua/h-lua)
require "h-lua" -- h-lua库
require "scripts.alias" -- alias h-lua库别称(参考)
require "scripts.setup" -- setup 游戏准备
require "scripts.eventReaction" -- 事件反应
require "scripts.damaging" -- 伤害流
require "scripts.quest" -- 任务
require "scripts.cmd" -- 指令
require "scripts.ui" -- UI
-- h-lua main function 主函数入口
-- The game starts here 游戏从main函数开始运行
function main()
SETUP()
UI()
-- 初始调试物品
hitem.create({
id = hslk.n2i("双铁剑"),
charges = 2,
x = 400,
y = 400,
})
for _ = 1, 12 do
hitem.create({
id = hslk.n2i("铁剑"),
charges = 1,
x = 156,
y = 785,
})
hitem.create({
id = hslk.n2i("铁盾"),
charges = 1,
x = 872,
y = 551,
})
end
-- 这些ID只要正确使用了slkHelper,就可以根据名称获得ID,极其爽
local uidMe = hslk.n2i("剑士")
local uidEnemy = hslk.n2i("骑士")
-- 创造一个我的剑士打倒敌人骑兵
local me = hunit.create({
whichPlayer = hplayer.players[1],
id = uidMe,
x = 0,
y = 0,
attr = _attr({
move = "=522",
}),
})
table.insert(hhero.player_heroes[1], me)
hevent.onLevelUp(me, function(evtData)
hattr.set(evtData.triggerUnit, 0, {
attack = "+30",
})
end)
hunit.subCurMana(me, 100)
-- 伤害变成经验
hevent.onDamage(me, function(evtData)
haward.forUnitExp(evtData.triggerUnit, evtData.damage)
end)
local knight = henemy.create({
id = uidEnemy,
x = 0,
y = 0,
qty = 1,
})
dump(htime.date())
htime.setInterval(1, function(curTimer)
if (hterrain.isWater(hunit.x(me), hunit.y(me))) then
htextTag.create2Unit(me, "你在水里", 10, "80ffff", 1.0, 1, 200)
else
htextTag.create2Unit(me, "你不在水里", 10, "ffffff", 1.0, 1, 200)
end
end)
end
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/alexzshl/hlua-helloworld.git
git@gitee.com:alexzshl/hlua-helloworld.git
alexzshl
hlua-helloworld
hlua-helloworld
main

搜索帮助