37 lines
868 B
Lua
37 lines
868 B
Lua
|
|
ground = ag.createStaticPlane(0, 0, 0, 0, 0, 0)
|
|
ground:setColor(0.2, 1.0, 0.2)
|
|
ag.setCamera(10, -10, 10, 0, 0, 0)
|
|
|
|
if (ag.import("rot_camera") ~= true) then
|
|
ag.println("error importing rot_camera")
|
|
ag.exit()
|
|
end
|
|
|
|
function init(obj)
|
|
obj:setColor(math.random(), math.random(), math.random())
|
|
obj:setPosition((math.random() - 0.5) * 10, (math.random() - 0.5) * 10, 10)
|
|
end
|
|
|
|
function update_event()
|
|
rot_camera()
|
|
end
|
|
|
|
function key_down_event(key)
|
|
if (key == "b") then
|
|
box = ag.createBox(1, 1, 1)
|
|
init(box)
|
|
elseif (key == "c") then
|
|
cyl = ag.createCylinder(0.5, 1)
|
|
init(cyl)
|
|
elseif (key == "a") then
|
|
ccyl = ag.createCapsule(0.5, 1)
|
|
init(ccyl)
|
|
elseif (key == "s") then
|
|
sphere = ag.createSphere(0.8)
|
|
init(sphere)
|
|
elseif (key == "q") then
|
|
ag.exit()
|
|
end
|
|
end
|