Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("right")
- first = false
- score = 0
- if fs.open("save", "a") == nil then
- save = fs.open("save", "w")
- first = true
- else
- fs.open("save", "a")
- first = false
- end
- if first == false then
- score = tonumber(save.readLine(1))
- end
- save.close()
- while true do
- save = fs.open("save", "w")
- event, side, x, y = os.pullEvent("monitor_touch")
- redstone.setOutput("top", true)
- os.sleep(0.15)
- redstone.setOutput("top", false)
- score = score + 1
- mon.setCursorPos(1,1)
- mon.clear()
- mon.write(score)
- save.write(tostring(score))
- save.close()
- os.sleep(0.25)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement