Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local icon_cookie = paintutils.loadImage("cookie")
- upgrade = 1
- upgradecost = 10
- cookie = 0
- c1 = colors.cyan
- c2 = colors.white
- c3 = colors.black
- function drawScreen()
- term.setBackgroundColor(c2)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(c1)
- term.clearLine()
- term.setCursorPos(1,2)
- term.clearLine()
- term.setCursorPos(1,3)
- term.clearLine()
- term.setCursorPos(3,2)
- print(" "..cookie.." COOKIES")
- term.setCursorPos(1,19)
- term.clearLine()
- term.setCursorPos(4,6)
- term.setBackgroundColor(c2)
- paintutils.drawImage(icon_cookie,10,6)
- term.setCursorPos(3,19)
- term.setBackgroundColor(c1)
- write("[ UPGRADE ] [ EXIT ]")
- end
- function upgrades()
- term.setBackgroundColor(c2)
- term.setTextColor(c3)
- term.clear()
- term.setBackgroundColor(c1)
- term.setCursorPos(1,1)
- term.clearLine()
- write(" [exit] Upgrades")
- term.setBackgroundColor(c2)
- term.setCursorPos(2,3)
- print("[ UPGRADE ] Cost: "..upgradecost)
- slc = 0
- local event, button, x, y = os.pullEvent()
- while true do
- if slc == 0 then
- if event == "mouse_click" then
- if x >= 3 and x <= 13 and y == 3 and button == 1 then slc = 0
- cookie = cookie - upgradecost
- if cookie <= 0 then
- cookie = cookie + upgradecost
- upgrades()
- end
- upgrade = upgrade + 1
- upgradecost = upgradecost + 3
- upgrades()
- elseif x >= 1 and x >= 6 and y == 1 and button == 1 then slc = 0
- main()
- else
- upgrades()
- end
- end
- end
- end
- end
- slc = 0
- function main()
- while true do
- drawScreen()
- local event, button, x, y = os.pullEvent()
- if slc == 0 then
- if event == "mouse_click" then
- if x >= 3 and x <= 13 and y == 19 and button == 1 then slc = 0
- upgrades()
- elseif x >= 10 and x <= 20 and y >= 6 and y <= 15 then
- cookie = cookie + upgrade
- main()
- elseif x >= 15 and x <= 21 and y == 19 and button == 1 then slc = 0
- os.reboot()
- else
- main()
- end
- end
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement