2024-02-24 16:16:09 +00:00
|
|
|
function on_init()
|
|
|
|
local cube = world:request_res("assets/cube-texture-embedded.gltf")
|
|
|
|
print("Loaded textured cube")
|
2024-02-24 19:32:06 +00:00
|
|
|
|
|
|
|
local pos = Transform.from_translation(Vec3.new(0, 0, -8.0))
|
|
|
|
|
2024-02-24 20:27:01 +00:00
|
|
|
local e = world:spawn(pos, cube)
|
2024-02-24 19:32:06 +00:00
|
|
|
print("spawned entity " .. tostring(e))
|
2024-01-07 05:57:19 +00:00
|
|
|
end
|
|
|
|
|
2024-02-24 16:16:09 +00:00
|
|
|
--[[ function on_first()
|
2024-01-07 05:57:19 +00:00
|
|
|
print("Lua's first function was called")
|
|
|
|
end
|
|
|
|
|
|
|
|
function on_pre_update()
|
|
|
|
print("Lua's pre-update function was called")
|
2024-01-13 16:52:20 +00:00
|
|
|
end ]]
|
2024-01-07 05:57:19 +00:00
|
|
|
|
|
|
|
function on_update()
|
2024-02-19 16:27:49 +00:00
|
|
|
---@type number
|
2024-02-18 00:08:11 +00:00
|
|
|
local dt = world:resource(DeltaTime)
|
|
|
|
|
|
|
|
world:view(function (t)
|
2024-02-19 22:57:48 +00:00
|
|
|
t:translate(0, 0.5 * dt, 0)
|
2024-01-13 16:52:20 +00:00
|
|
|
|
2024-02-18 00:08:11 +00:00
|
|
|
return t
|
|
|
|
end, Transform)
|
2024-01-07 05:57:19 +00:00
|
|
|
end
|
|
|
|
|
2024-01-13 16:52:20 +00:00
|
|
|
--[[ function on_post_update()
|
2024-01-07 05:57:19 +00:00
|
|
|
print("Lua's post-update function was called")
|
|
|
|
end
|
|
|
|
|
|
|
|
function on_last()
|
|
|
|
print("Lua's last function was called")
|
2024-01-13 16:52:20 +00:00
|
|
|
end ]]
|