Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local scroll = 0;
- local jump = 0;
- local char = ">";
- local coins = 0;
- local x,y = term.getSize()
- function newCoin(posX, posY)
- term.setCursorPos(posX - scroll, posY + jump)
- coin = "O";
- if not posX - scroll < x-1 then
- if(posX - scroll == x/2 and posY + jump == y-10)then
- coins = coins+1
- coin = ""
- else
- write(coin)
- end
- end
- end
- function redraw()
- term.clear()
- term.setCursorPos(1,1)
- write("Coins: " ..coins)
- term.setCursorPos(x/2, y-10)
- write(char)
- for i=1,x-1 do
- term.setCursorPos(i, y-9 + jump)
- write("A")
- end
- newCoin(x/2, y-14)
- end
- while true do
- redraw()
- local event, a, b = os.pullEvent();
- if(event == "char" and a == "a")then
- scroll = scroll-1
- char = "<"
- elseif(event == "char" and a == "d")then
- scroll = scroll+1
- char = ">"
- elseif(event == "key" and a == 57)then
- jump = 1
- for i=1,4 do
- sleep(0.1)
- jump = i
- redraw()
- end
- for i=1,4 do
- sleep(0.1)
- jump = jump-i
- redraw()
- end
- jump = 0
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement