Playertest: scene/script system refactor and Wii ABI fix
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
local Cube = setmetatable({}, { __index = Entity })
|
||||
Cube.__index = Cube
|
||||
|
||||
function Cube.new()
|
||||
local self = Entity.new()
|
||||
setmetatable(self, Cube)
|
||||
self:add(Entity.POSITION)
|
||||
self.position.x = 0
|
||||
self.position.y = 0
|
||||
self.position.z = 0
|
||||
self:add(Entity.MESH)
|
||||
self:add(Entity.MATERIAL)
|
||||
self.material.color = colorRed()
|
||||
return self
|
||||
end
|
||||
|
||||
function Cube:update()
|
||||
local speed = 3.0
|
||||
local dx = inputAxis(INPUT_ACTION_LEFT, INPUT_ACTION_RIGHT)
|
||||
local dz = inputAxis(INPUT_ACTION_UP, INPUT_ACTION_DOWN)
|
||||
self.position.x = self.position.x + dx * speed * TIME.delta
|
||||
self.position.z = self.position.z + dz * speed * TIME.delta
|
||||
end
|
||||
|
||||
return Cube
|
||||
+1
-7
@@ -1,8 +1,3 @@
|
||||
module('input')
|
||||
module('platform')
|
||||
module('scene')
|
||||
module('locale')
|
||||
|
||||
-- Default Input bindings.
|
||||
if PSP then
|
||||
inputBind("up", INPUT_ACTION_UP)
|
||||
@@ -77,5 +72,4 @@ else
|
||||
print("Unknown platform, no default input bindings set.")
|
||||
end
|
||||
|
||||
-- Hand off to initial scene.
|
||||
sceneSet('test/scene.lua')
|
||||
Scene.set('scenes/cube.lua')
|
||||
@@ -0,0 +1,30 @@
|
||||
local Cube = include('entities/cube.lua')
|
||||
|
||||
local SceneCube = {}
|
||||
SceneCube.__index = SceneCube
|
||||
|
||||
local cam
|
||||
local cube
|
||||
|
||||
function SceneCube:init()
|
||||
cam = Entity.new()
|
||||
cam:add(Entity.POSITION)
|
||||
cam.position.x = 3
|
||||
cam.position.y = 3
|
||||
cam.position.z = 3
|
||||
cam.position:lookAt(0, 0, 0)
|
||||
cam:add(Entity.CAMERA)
|
||||
|
||||
cube = Cube.new()
|
||||
end
|
||||
|
||||
function SceneCube:update()
|
||||
cube:update()
|
||||
end
|
||||
|
||||
function SceneCube:dispose()
|
||||
cam:dispose()
|
||||
cube:dispose()
|
||||
end
|
||||
|
||||
return SceneCube
|
||||
Reference in New Issue
Block a user