lyra-engine/examples/testbed/scripts/test.lua

48 lines
1.1 KiB
Lua
Raw Normal View History

print("Hello World")
--[[ function on_init()
print("Lua script was initialized!")
end
function on_first()
print("Lua's first function was called")
end
function on_pre_update()
print("Lua's pre-update function was called")
end ]]
function on_update()
--print("Lua's update function was called")
--[[ world:view(
---@param t Transform
function (t)
print("Found entity at a really cool place: " .. tostring(t))
t.translation:move_by(0, 0.001, 0)
return t
end,
Transform
) ]]
---@type number
local dt = world:resource(DeltaTime)
--print("DeltaTime was " .. tostring(dt) .. "s")
world:view(function (t)
--print("Found entity at a really cool place: " .. tostring(t))
--t.translation = t.translation + (Vec3.new(0, 0.5, 0) * dt:get())
t.translation:move_by(0, 0.5 * dt, 0)
return t
end, Transform)
end
--[[ function on_post_update()
print("Lua's post-update function was called")
end
function on_last()
print("Lua's last function was called")
end ]]