Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- map = paintutils.loadImage("files/map")
- paintutils.drawImage(map, 1, 1)
- term.setCursorPos(28, 10)
- print("@")
- local X = 28
- local Y = 10
- local score = 0
- local hp = 1647
- local coina = 1
- local coina_X = 2
- local coina_Y = 2
- local coinb = 1
- local coinb_X = 8
- local coinb_Y = 15
- local coinc = 1
- local coinc_X = 9
- local coinc_Y = 4
- local coind = 1
- local coind_X = 30
- local coind_Y = 2
- local coine = 1
- local coine_X = 15
- local coine_Y = 8
- local moba = 1
- local moba_X = 10
- local moba_Y = 14
- function player()
- local event, move = os.pullEvent ("char")
- if move == "a" then
- X=X-1
- term.clear()
- paintutils.drawImage(map, 1, 1)
- term.setCursorPos(X, Y)
- print("<")
- else if move == "d" then
- X=X+1
- term.clear()
- paintutils.drawImage(map, 1, 1)
- term.setCursorPos(X, Y)
- print(">")
- else if move == "w" then
- Y=Y-1
- term.clear()
- paintutils.drawImage(map, 1, 1)
- term.setCursorPos(X, Y)
- print("^")
- else if move == "s" then
- Y=Y+1
- term.clear()
- paintutils.drawImage(map, 1, 1)
- term.setCursorPos(X, Y)
- print("V")
- end
- end
- end
- end
- if X <= 0 then
- X=1
- else if X >= 52 then
- X=51
- else if Y >= 19 then
- Y=18
- else if Y <= 1 then
- Y=2
- end
- end
- end
- end
- if hp <= 0 then
- game_end()
- end
- term.clear()
- paintutils.drawImage(map, 1, 1)
- term.setCursorPos(X, Y)
- print("@")
- term.setCursorPos(1,1)
- print("HP: "..hp)
- term.setCursorPos(14,1)
- print("Kills: "..score)
- end
- function coins()
- if coina == 1 then
- term.setCursorPos(coina_X,coina_Y)
- print("$")
- if X == coina_X and Y == coina_Y then
- score=score+1
- coina=0
- end
- end
- if coinb == 1 then
- term.setCursorPos(coinb_X,coinb_Y)
- print("$")
- if X == coinb_X and Y == coinb_Y then
- score=score+1
- coinb=0
- end
- end
- if coinc == 1 then
- term.setCursorPos(coinc_X,coinc_Y)
- print("$")
- if X == coinc_X and Y == coinc_Y then
- score=score+1
- coinc=0
- end
- end
- if coind == 1 then
- term.setCursorPos(coind_X,coind_Y)
- print("$")
- if X == coind_X and Y == coind_Y then
- score=score+1
- coind=0
- end
- end
- if coine == 1 then
- term.setCursorPos(coine_X,coine_Y)
- print("$")
- if X == coine_X and Y == coine_Y then
- score=score+1
- coine=0
- end
- end
- end
- function mob()
- if moba == 1 then
- term.setCursorPos(moba_X,moba_Y)
- print("1")
- if X == moba_X and Y == moba_Y then
- X=28
- Y=10
- hp=hp-1
- end
- end
- end
- function ai()
- end
- function weapon()
- end
- function game_end()
- term.clear()
- term.setCursorPos(8, 5)
- print("YOU LOST!")
- term.setCursorPos(8, 6)
- print("Thankyou for playing!")
- term.setCursorPos(8, 7)
- print("Made by Twig1233")
- term.setCursorPos(8, 8)
- print("Your score was: "..score)
- shell.run("game")
- end
- while true do
- player()
- coins()
- mob()
- if score >= 5 then
- term.clear()
- term.setCursorPos(8, 5)
- print("YOU WON!")
- term.setCursorPos(8, 6)
- print("Thankyou for playing!")
- term.setCursorPos(8, 7)
- print("Made by maxderopnl")
- term.setCursorPos(8, 8)
- print("Your score was: "..score)
- shell.run("game")
- end
- sleep(0.01)
- end
Advertisement
Add Comment
Please, Sign In to add comment