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
- local Score = 0
- local Speed = 1
- function Paint()
- term.clear()
- paintutils.drawFilledBox(1,1,26,20,colors.cyan)
- -- Clouds
- paintutils.drawFilledBox(1,1,3,1,colors.white)
- paintutils.drawFilledBox(5,2,10,2,colors.white)
- paintutils.drawFilledBox(6,2,8,3,colors.white)
- paintutils.drawFilledBox(17,1,18,1,colors.white)
- paintutils.drawFilledBox(16,4,21,5,colors.white)
- -- Sun
- paintutils.drawFilledBox(23,1,26,2,colors.yellow)
- -- Buildings/Mountains (Not sure what they are)
- paintutils.drawFilledBox(3,14,5,20,colors.lightGray)
- paintutils.drawFilledBox(5,12,7,20,colors.lightBlue)
- paintutils.drawFilledBox(9,13,11,20,colors.pink)
- paintutils.drawFilledBox(11,16,13,20,colors.lime)
- paintutils.drawFilledBox(14,14,16,20,colors.red)
- -- Birb
- paintutils.drawPixel(x,y,colors.orange)
- -- Pipes
- PipeGen()
- --Ground
- paintutils.drawFilledBox(1,18,26,20,colors.brown)
- -- Pond/Puddle
- paintutils.drawLine(18,18,26,18,colors.blue)
- paintutils.drawLine(19,19,26,19,colors.blue)
- if (Speed == 0.01) then
- paintutils.drawPixel(9,10,colors.cyan)
- term.setCursorPos(9,10)
- term.setTextColor(colors.red)
- term.write("GAME OVER")
- end
- --Score
- paintutils.drawPixel(13,1,colors.cyan)
- term.setCursorPos(13,1)
- term.setTextColor(colors.white)
- term.write(Score)
- end
- function Physics()
- if (x==pX) then
- if (y<pYo or y>=pYf) then -- Game over
- Speed = 0.01
- else
- Score =Score+1
- Speed=Speed+0.1
- end
- elseif (y>=17) then -- Game over
- Speed = 0.01
- 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,16)
- pYo = r-2
- pYf = r+2
- end
- end
- -- Main --
- while(true) do
- parallel.waitForAny(function()
- if (Speed>0.01) then
- Physics()
- Paint()
- end
- sleep(0.5/Speed)
- end,
- function()
- os.pullEvent("key")
- if (Speed>0.01) then
- y=y-2
- end
- end,
- function()
- os.pullEvent("mouse_click")
- if (Speed>0.01) then
- y=y-2
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment