42 lines
892 B
Lua
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
|