anaglym/lib/demo/bowling.lua
Josh Holtrop bb76eb6e9b added ag::drawPoint()
git-svn-id: svn://anubis/anaglym/trunk@205 99a6e188-d820-4881-8870-2d33a10e2619
2009-12-13 18:38:57 +00:00

42 lines
892 B
Lua

function setupPins()
for i = 1, 10 do
if (pins[i] ~= nil) then
pins[i]:destroy()
end
end
end
function setupStars()
stars = {}
local dist = 500
for i = 1, 1000 do
local star = {}
local rx = math.random() * math.pi * 2
local ry = (math.random() - 0.5) * math.pi
star.x = dist * math.cos(ry) * math.cos(rx)
star.y = dist * math.cos(ry) * math.sin(rx)
star.z = dist * math.sin(ry)
star.size = math.random(2, 8)
stars[i] = star
end
end
function drawStars()
for i = 1, #stars do
ag.drawPoint(stars[i].size, 1, 1, 1, stars[i].x, stars[i].y, stars[i].z)
end
end
function init_event()
pins = {}
lane = ag.loadModelStatic("bowling_lane")
setupPins()
setupStars()
ag.setCamera(0, -20, 5, 0, 20, 0)
end
function update_event()
drawStars()
end