Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local vel, x, y = 1, 13, 10
- local pX, pYo, pYf = 26, 1, 5
- function Paint()
- term.clear()
- paintutils.drawFilledBox(1,1,26,20,colors.white)
- -- Birb
- paintutils.drawPixel(x,y,colors.orange)
- PipeGen()
- end
- function Physics()
- if (x==pX and (y<=pYo and y>=pYf)) then
- error("You loose",0)
- end
- y=y+vel
- end
- function PipeGen()
- paintutils.drawLine(pX,1,pX,pYo,colors.green) -- Top pipe
- paintutils.drawLine(pX,pYf,pX,20,colors.green) -- Bottom pipe
- pX=pX-1
- if (pX<=0) then
- pX = 26
- local r = math.random(2,18)
- pYo = r-2
- pYf = r+2
- end
- end
- -- Main --
- while(true) do
- parallel.waitForAny(function()
- Physics()
- Paint()
- sleep(0.5)
- end,
- function()
- os.pullEvent("key")
- y=y-2
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement