mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-14 16:09:06 +07:00
dummy sample_08
This commit is contained in:
26
samples/bin/library/scenes/sample_08.json
Normal file
26
samples/bin/library/scenes/sample_08.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"components" : {
|
||||
"scene" : {},
|
||||
"behaviour" : {
|
||||
"script" : "../scripts/sample_08/sample_08.lua"
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/camera_prefab.json"
|
||||
},{
|
||||
"prototype" : "../prefabs/ship_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [0,0],
|
||||
"scale" : 1
|
||||
},
|
||||
"behaviour" : {
|
||||
"script" : "../scripts/sample_08/ship.lua"
|
||||
},
|
||||
"touchable" : {},
|
||||
"rect_collider" : {
|
||||
"size" : [66,113]
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
22
samples/bin/library/scripts/sample_08/sample_08.lua
Normal file
22
samples/bin/library/scripts/sample_08/sample_08.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local M = {}
|
||||
|
||||
---@param go gobject
|
||||
function M:on_start(go)
|
||||
the_debug:trace("sample_08: on_start")
|
||||
end
|
||||
|
||||
---@param go gobject
|
||||
function M:on_update(go)
|
||||
end
|
||||
|
||||
---@param go gobject
|
||||
---@param type string
|
||||
---@param event any
|
||||
function M:on_event(go, type, event)
|
||||
end
|
||||
|
||||
---@param go gobject
|
||||
function M:on_shutdown(go)
|
||||
end
|
||||
|
||||
return M
|
||||
36
samples/bin/library/scripts/sample_08/ship.lua
Normal file
36
samples/bin/library/scripts/sample_08/ship.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- private
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
---@class ship_meta
|
||||
|
||||
---@param meta ship_meta
|
||||
---@param go gobject
|
||||
local function update_ship_rotation(meta, go)
|
||||
local time = the_engine.time
|
||||
go.actor.node.rotation = time
|
||||
end
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- meta
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
local M = {}
|
||||
|
||||
---@param meta ship_meta
|
||||
---@param go gobject
|
||||
function M.on_start(meta, go)
|
||||
meta.life_time = 5
|
||||
end
|
||||
|
||||
---@param meta ship_meta
|
||||
---@param go gobject
|
||||
function M.on_update(meta, go)
|
||||
update_ship_rotation(meta, go)
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user