Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Config
- local FishSimulatorVersion = "1.6.8"
- local fishX = 10
- local fishY = 10
- local fishHealth = 40
- local fishLt = "(O<"
- local fishRt = ">O)"
- local fishX2 = 12
- local fishY2 = 12
- local fishX3 = 6
- local fishY3 = 7
- local fishX4 = 14
- local fishY4 = 13
- --Extra Variables
- local reset = 19
- local feed = 33 -- the key id for the F key
- local h = colors.green -- h is the variable for the color of the health number
- local fishLook = true -- true means left false means right
- local fishLook2 = false
- local fishLook3 = true
- local fishLook4 = false
- FishScreen = {
- {},{},{},{},{},{},{},{0, 0,
- 0, 0,
- 0, 0,
- 0, 0,
- 0, 0,
- 0, 0, 0,
- 0, 0,
- 0, 0,
- 0, 0,
- 0, 0,
- 0, 0,
- 0, 0, 0,
- 0, 0,
- 0, 0,
- 0, 0,
- 0, 0,
- 0, 0,
- 0, 0,
- 0, 0,
- 0, 0,
- },
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- },
- {},
- {},
- {},
- {},
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 32,
- 0,
- 0,
- 0,
- 32,
- 0,
- 0,
- 0,
- 0,
- 0,
- 32,
- 0,
- 0,
- 0,
- 32,
- },
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 8192,
- 0,
- 32,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 32,
- 0,
- 0,
- 0,
- 0,
- 32,
- },
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 8192,
- 0,
- 8192,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 8192,
- 0,
- 0,
- 0,
- 0,
- 8192,
- },
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 8192,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 8192,
- 0,
- 0,
- 8192,
- },
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 8192,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 8192,
- 0,
- 0,
- 8192,
- },
- {
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- 16,
- },
- }
- --Functions
- function reset()
- term.setCursorPos(3,3)
- print("Resetting Fish Positions")
- fishX = 10
- fishY = 10
- fishX2 = 12
- fishY2 = 12
- fishX3 = 14
- fishY3 = 13
- fishLook = true -- true means left false means right
- fishLook2 = false
- fishLook3 = true
- fishLook4 = false
- end
- function fishFeed()
- term.setCursorPos(5,5)
- term.setBackgroundColor(colors.lightBlue)
- print("Feeding Your Fish!")
- fishHealth = fishHealth+1.5
- if fishHealth < 10 then
- h = colors.red
- elseif fishHealth < 20 then
- h = colors.orange
- elseif fishHealth > 30 then
- h = colors.green
- elseif fishHealth > 20 then
- h = 1
- elseif fishHealth < 10 then
- h = colors.red
- end
- if fishHealth > 40 then
- term.setCursorPos(5,5)
- term.setBackgroundColor(colors.lightBlue)
- print("Your Fish Was Overfed!")
- sleep(1)
- term.clear()
- term.setTextColor(1)
- term.setCursorPos(1,1)
- print("Restart? (Y/N)")
- E,K = os.pullEvent("key")
- y = 21
- n = 49
- if K == y then
- shell.run("pastebin run 5x9Uu1pr")
- error()
- elseif K == n then
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- error()
- shell.run("shell")
- end
- end
- if fishHealth < .5 then
- term.setCursorPos(5,5)
- term.setBackgroundColor(colors.lightBlue)
- print("Your Fish Starved To Death!")
- sleep(1)
- term.clear()
- term.setTextColor(1)
- term.setCursorPos(1,1)
- print("Restart? (Y/N)")
- E,K = os.pullEvent("key")
- y = 21
- n = 49
- if K == y then
- shell.run("pastebin run 5x9Uu1pr")
- error()
- elseif K == n then
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- error()
- shell.run("shell")
- end
- end
- end
- function fishMove()
- term.setBackgroundColor(colors.lightBlue)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(1)
- term.write("Fish's Life: ")
- term.setTextColor(h)
- term.write(fishHealth)
- term.setCursorPos(fishX,fishY)
- term.setTextColor(colors.black)
- term.setBackgroundColor(fishC1)
- if fishLook then
- term.write(fishLt)
- else if fishLook == false then
- term.write(fishRt)
- end
- end
- move3 = math.random(4)
- if move3 == 1 then
- fishX3 = fishX3-1
- fishLook3 = true
- elseif move3 == 2 then
- fishX3 = fishX3+1
- fishLook3 = false
- elseif move3 == 3 then
- fishY3 = fishY3-1
- elseif move3 == 4 then
- fishY3 = fishY3+1
- end
- term.setCursorPos(fishX3,fishY3)
- term.setTextColor(colors.black)
- term.setBackgroundColor(fishC3)
- if fishLook3 then
- term.write(fishLt)
- else
- term.write(fishRt)
- end
- move2 = math.random(4)
- fishHealth = fishHealth - .5
- if move2 == 1 then
- fishX2 = fishX2-1
- fishLook2 = true
- elseif move2 == 2 then
- fishX2 = fishX2+1
- fishLook2 = false
- elseif move2 == 3 then
- fishY2 = fishY2-1
- elseif move2 == 4 then
- fishY2 = fishY2+1
- end
- term.setCursorPos(fishX2,fishY2)
- term.setTextColor(colors.black)
- term.setBackgroundColor(fishC2)
- if fishLook2 then
- print(fishLt)
- else
- print(fishRt)
- end
- move = math.random(4)
- if move == 1 then
- fishX = fishX-1
- fishLook = true
- elseif move == 2 then
- fishX = fishX+1
- fishLook = false
- elseif move == 3 then
- fishY = fishY-1
- elseif move == 4 then
- fishY = fishY+1
- --Health ColorChangers
- if fishHealth < 5 then
- h = colors.red
- elseif fishHealth < 10 then
- h = colors.orange
- elseif fishHealth > 15 then
- h = colors.green
- elseif fishHealth > 9 then
- h = 1
- elseif fishHealth < 5 then
- h = colors.red
- end
- if fishHealth > 40 then
- term.setCursorPos(5,5)
- term.setBackgroundColor(colors.lightBlue)
- term.clear()
- print("Your Fish Was Overfed!")
- sleep(1)
- term.clear()
- term.setTextColor(1)
- term.setCursorPos(1,1)
- print("Restart? (Y/N)")
- E,K = os.pullEvent("key")
- y = 21
- n = 49
- if K == y then
- shell.run("pastebin run 5x9Uu1pr")
- error()
- elseif K == n then
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- error()
- shell.run("shell")
- end
- end
- if fishHealth < .5 then
- term.setCursorPos(5,5)
- term.setBackgroundColor(colors.lightBlue)
- print("Your Fish Starved To Death!")
- sleep(1)
- term.clear()
- term.setTextColor(1)
- term.setCursorPos(1,1)
- print("Restart? (Y/N)")
- E,K,L = os.pullEvent()
- y = 21
- n = 49
- if E == "key" then
- if K == y then
- shell.run("pastebin run 5x9Uu1pr")
- error()
- elseif K == n then
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- error()
- shell.run("shell")
- end
- elseif E == "monitor_touch" and L == 1 and K == 11 then
- shell.run("pastebin run 5x9Uu1pr")
- error()
- else
- error()
- end
- end
- end
- paintutils.drawImage(FishScreen,1,1)
- term.setBackgroundColor(colors.lightBlue)
- end
- --Startup Screen
- function sScreen()
- local fish1 = math.random(2)
- local fish2 = math.random(2)
- local fish3 = math.random(2)
- if fish1 == 1 then
- fishC1 = colors.orange
- else
- fishC1 = colors.yellow
- end
- if fish2 == 1 then
- fishC2 = colors.blue
- else
- fishC2 = colors.lime
- end
- if fish3 == 1 then
- fishC3 = colors.red
- else
- fishC3 = colors.white
- end
- term.setBackgroundColor(colors.lightBlue)
- term.setTextColor(colors.black)
- term.clear()
- paintutils.drawImage(FishScreen,1,1)
- paintutils.drawImage(FishScreen,1,1)
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.lightBlue)
- print("Fish Simulator v. "..FishSimulatorVersion)
- term.setCursorPos(fishX,fishY)
- term.setBackgroundColor(fishC1)
- print(fishLt)
- term.setBackgroundColor(fishC2)
- term.setCursorPos(fishX2,fishY2)
- print(fishRt)
- term.setBackgroundColor(fishC3)
- term.setCursorPos(fishX3,fishY3)
- print(fishLt)
- term.setBackgroundColor(colors.lightBlue)
- sleep(.50)
- term.setCursorPos(1,2)
- print("Fire An Event To Begin.")
- os.pullEvent()
- fishMove()
- --Run Code
- local id = os.startTimer(1)
- while true do
- local event = {os.pullEvent()}
- if event[ 1 ] == "timer" and event[ 2 ] == id then
- fishMove()
- id = os.startTimer(1)
- elseif event[ 1 ] == "key" and event[ 2 ] == feed then
- fishFeed()
- elseif event[ 1 ] == "monitor_touch" then
- fishFeed()
- elseif event[ 1 ] == "key" and event[ 2 ] == 19 then
- reset()
- end
- end
- end
- sScreen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement