dummy sample_08

This commit is contained in:
2019-12-04 10:28:25 +07:00
parent feac21cad6
commit 36cb725cc1
5 changed files with 172 additions and 0 deletions

View 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]
}
}
}]
}

View 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

View 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