Big ol refactor of scripts
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
module('entity')
|
||||
module('math')
|
||||
module('color')
|
||||
|
||||
function entityInit()
|
||||
entityPositionAdd(ENTITY_ID)
|
||||
|
||||
local phys = entityPhysicsAdd(ENTITY_ID)
|
||||
phys.bodyType = PHYSICS_BODY_STATIC
|
||||
phys:setShapePlane(0, 1, 0, 0)
|
||||
phys:setShapePlane(vec3(0, 1, 0), 0)
|
||||
|
||||
local mesh = entityMeshAdd(ENTITY_ID)
|
||||
mesh:generatePlane(20, 20)
|
||||
|
||||
entityMaterialAdd(ENTITY_ID)
|
||||
local mat = entityMaterialAdd(ENTITY_ID)
|
||||
mat.color = colorBlack()
|
||||
end
|
||||
|
||||
function entityDispose()
|
||||
|
||||
@@ -9,6 +9,7 @@ module('entitycamera')
|
||||
local phys
|
||||
local updateSub
|
||||
local SPEED = 4.0
|
||||
local mat
|
||||
|
||||
function entityInit()
|
||||
local pos = entityPositionAdd(ENTITY_ID)
|
||||
@@ -22,8 +23,7 @@ function entityInit()
|
||||
local mesh = entityMeshAdd(ENTITY_ID)
|
||||
mesh:generateCapsule(0.3, 0.9)
|
||||
|
||||
local mat = entityMaterialAdd(ENTITY_ID)
|
||||
mat.color = colorBlue()
|
||||
mat = entityMaterialAdd(ENTITY_ID)
|
||||
|
||||
updateSub = eventSubscribe(SCENE_EVENT_UPDATE, onUpdate)
|
||||
end
|
||||
@@ -32,6 +32,8 @@ function onUpdate()
|
||||
local moveX = inputAxis(INPUT_ACTION_LEFT, INPUT_ACTION_RIGHT)
|
||||
local moveZ = inputAxis(INPUT_ACTION_DOWN, INPUT_ACTION_UP)
|
||||
|
||||
mat.color = colorRainbow()
|
||||
|
||||
local cam = entityCameraGetCurrent()
|
||||
local fwd = cam:getForward()
|
||||
local right = cam:getRight()
|
||||
|
||||
+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')
|
||||
print('Inited')
|
||||
Reference in New Issue
Block a user