Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local x = 20
- local y = 10
- local sX, sY = x, y + 0 + 1
- local monsterX = math.random(1,20)
- local monsterY = math.random(1,10)
- local points = 0
- local kM = false
- while true do
- term.clear()
- term.setCursorPos(x,y)
- print"@"
- term.setCursorPos(sX,sY)
- print("-|--")
- term.setCursorPos(50,1)
- print(points)
- if monsterX ~= sX and monsterY ~= sY then
- term.setCursorPos(monsterX, monsterY)
- print"!"
- end
- local hendelse, tast = os.pullEvent("key")
- if monsterX == sX and monsterY == sY then
- monsterX = math.random(1,70)
- monsterY = math.random(1,50)
- term.setCursorPos(monsterX, monsterY)
- term.clear()
- points = points + 1
- local kM = true
- end
- if tast == keys.q then
- break
- end
- if x == monsterX and y == monsterY then
- term.setCursorPos(30,10)
- print"You died"
- sleep(.5)
- break
- end
- if tast == keys.right then
- x = x + 1
- sX = sX + 1
- end
- if tast == keys.left then
- x = x - 1
- sX = sX - 1
- end
- if tast == keys.up then
- y = y - 1
- sY = sY + -1
- end
- if tast == keys.down then
- y = y + 1
- sY = sY + 1
- end
- end
Add Comment
Please, Sign In to add comment