Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local star = {5,5}
- --term.redirect(peripheral.wrap("right"))
- local w,h = term.getSize()
- local xDir = "+"
- local yDir = "+"
- local grav = 0
- local gravActive = true
- function redraw(x,y)
- draw("*",x,y)
- sleep(.05)
- draw(" ",x,y)
- end
- function showinfo()
- term.setCursorPos(1, 1)
- term.clearLine()
- draw(tostring(grav), w - #tostring(grav) + 1, 1)
- end
- function draw(words,x,y)
- term.setCursorPos(x,y)
- write(words)
- end
- while true do
- redraw(star[1],star[2])
- local prevPos = {posX, posY}
- local posX, posY = term.getCursorPos()
- if prevPos[2] == posY then
- gravActive = false
- end
- showinfo()
- if posX == 1 then
- xDir = "+"
- end
- if posY >= h then
- grav = (math.abs(grav) - .6)
- end
- if posX == w then
- xDir = "-"
- end
- if posY <= 1 then
- grav = -(math.abs(grav) - .6)
- end
- if xDir == "+" then
- star[1] = star[1] + 1
- else
- star[1] = star[1] - 1
- end
- if gravActive then
- star[2] = star[2] - grav
- grav = grav - .5
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement