how to make things fall off screen over and over
I am making a game where the player has to jump from line to line (there are 3 lines) to dodge falling objects, I am new to coding and especially new to the microstudio code. I tried making a loop to make the objects(or bricks) fall down and repeat but I cant figure it out
here is my code
init = function()
blockyX = [-100,0,100]
blockyI = 1
brick = [-100,0,100]
passed = [0,0,0]
end
movement = function()
if (keyboard.press.RIGHT and blockyI < blockyX.length -1) then
blockyI += 1
elsif (keyboard.press.LEFT and blockyI > 0) then
blockyI -= 1
end
end
update = function()
i = 400
while i <-200
screen.drawSprite("brick",blockyX[random],i)
i-=1
end
movement()
end
draw = function()
screen.clear("white")
screen.setLineWidth(5)
screen.drawLine(-100,150,-100,-150,"red")
screen.drawLine(0,150,0,-150,"red")
screen.drawLine(100,150,100,-150,"red")
screen.drawSprite("blocky",blockyX[blockyI],-75)
end
you can see the loop I tried to do but it didn't work because I don't really know what I'm doing pls help