And here is the code I' ve done so far, wich only makes a object fallin, and then ramdomize it at the top of the screen and then down again, and again and agin...
white = Color.new(255, 255, 255)
r0 = 0
r1 = math.random(480)
while true do
pad = Controls.read()
screen:clear()
screen:fillRect(r1, r0, 10, 10, white)
r0 = r0 + 1
if r0 == 272 then
r0 = -10
elseif r0 >= 271 then
r1 = math.random(480)
end
screen.flip()
screen:waitVblankStart(60)
if pad:start() then
break
end
end
A function that makes this falling object, so it can fall more then one.
Sure I can write:
screen:fillRect(r1, r0, 10, 10, white) again and another random number, but I need a function that MAKES a new copie of this object.
Perhaps you want to read the Lua book http://www.lua.org/pil/ , especially chaper 2.5. And you'll find in the starfield demo multiple objects, but moving from the center instead of dropping from top.