Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- mon = peripheral.find("monitor")
- mon.clear()
- mon.setTextScale(1)
- mon.setBackgroundColor(colors.black)
- local vie = 0
- local xjp, yjp = 0, 0
- function menu1()
- mon.clear()
- mon.setTextScale(2)
- mon.setCursorPos(1,5)
- mon.write("------------------------------------")
- mon.setCursorPos(16,2)
- mon.write("LuaMan")
- mon.setCursorPos(10,4)
- mon.write("Le Jeu CodåA9 En Lua ")
- mon.setCursorPos(4,9)
- mon.write("> Nouvelle partie.")
- mon.setCursorPos(4,12)
- mon.write(" Infos.")
- end
- function menu2()
- mon.clear()
- mon.setTextScale(2)
- mon.setCursorPos(1,5)
- mon.write("-------------------------------------")
- mon.setCursorPos(16,2)
- mon.write("LuaMan")
- mon.setCursorPos(10,4)
- mon.write("Le Jeu CodåA9 En Lua ")
- mon.setCursorPos(4,9)
- mon.write(" Nouvelle partie.")
- mon.setCursorPos(4,12)
- mon.write("> Infos.")
- end
- function menuchoix()
- menu1()
- local q = 0
- while q == 0 do
- id, cm = rednet.receive()
- if cm == "up" then
- menu1()
- mchoix = 1
- elseif cm == "down" then
- menu2()
- mchoix = 2
- elseif cm == "d" then
- q = 1
- if mchoix == 1 then
- partie()
- elseif mchoix == 2 then
- infos()
- end
- end
- end
- end
- function infos()
- end
- function saut()
- yjp = yjp - 1
- sleep(0.1)
- aff()
- yjp = yjp - 1
- sleep(0.1)
- aff()
- yjp = yjp - 1
- sleep(0.1)
- aff()
- yjp = yjp + 1
- sleep(0.1)
- aff()
- yjp = yjp + 1
- sleep(0.1)
- aff()
- yjp = yjp + 1
- sleep(0.1)
- aff()
- end
- function sautd()
- yjp = yjp - 1
- sleep(0.1)
- aff()
- yjp = yjp - 1
- sleep(0.1)
- aff()
- yjp = yjp - 1
- sleep(0.1)
- aff()
- yjp = yjp - 1
- sleep(0.1)
- aff()
- xjp = xjp + 1
- sleep(0.1)
- aff()
- xjp = xjp + 1
- sleep(0.1)
- aff()
- xjp = xjp + 1
- sleep(0.1)
- aff()
- xjp = xjp + 1
- sleep(0.1)
- aff()
- xjp = xjp + 1
- sleep(0.1)
- aff()
- yjp = yjp + 1
- sleep(0.1)
- aff()
- yjp = yjp + 1
- sleep(0.1)
- aff()
- yjp = yjp + 1
- sleep(0.1)
- aff()
- yjp = yjp + 1
- sleep(0.1)
- aff()
- end
- function sautg()
- yjp = yjp - 1
- sleep(0.1)
- aff()
- yjp = yjp - 1
- sleep(0.1)
- aff()
- yjp = yjp - 1
- sleep(0.1)
- aff()
- yjp = yjp - 1
- sleep(0.1)
- aff()
- xjp = xjp - 1
- sleep(0.1)
- aff()
- xjp = xjp - 1
- sleep(0.1)
- aff()
- xjp = xjp - 1
- sleep(0.1)
- aff()
- xjp = xjp - 1
- sleep(0.1)
- aff()
- xjp = xjp - 1
- sleep(0.1)
- aff()
- yjp = yjp + 1
- sleep(0.1)
- aff()
- yjp = yjp + 1
- sleep(0.1)
- aff()
- yjp = yjp + 1
- sleep(0.1)
- aff()
- yjp = yjp + 1
- sleep(0.1)
- aff()
- end
- function joueur()
- local yjp1 = yjp - 1
- local yjp2 = yjp1 - 1
- local yjp3 = yjp2 - 1
- mon.setCursorPos(xjp,yjp)
- mon.write(" /l ")
- mon.setCursorPos(xjp,yjp1)
- mon.write(" <| ")
- mon.setCursorPos(xjp,yjp2)
- mon.write(" ('> ")
- mon.setCursorPos(xjp,yjp3)
- mon.write(" ))) ")
- end
- function ecran()
- mon.setCursorPos(1,3)
- mon.write("-----------------------------------------------------------------------")
- mon.setCursorPos(1,27)
- mon.write("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|___|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
- mon.setCursorPos(63,2)
- mon.write("Vies : "..vie)
- end
- function aff()
- mon.clear()
- ecran()
- joueur()
- end
- function gameover()
- local tour = 0
- local tour2 = 0
- mon.clear()
- while tour ~= 5 do
- sleep(0.5)
- mon.setCursorPos(26,17)
- mon.write("Game Over")
- sleep(0.5)
- mon.clear()
- tour = tour + 1
- end
- while tour2 ~= 3 do
- mon.setCursorPos(26,17)
- mon.write("Vie : "..vie)
- sleep(0.5)
- mon.clear()
- sleep(0.5)
- tour2 = tour2 + 1
- end
- vie = vie - 1
- mon.setCursorPos(26,17)
- mon.write("Vie : "..vie)
- sleep(0.5)
- mon.clear()
- sleep(0.5)
- mon.setCursorPos(26,17)
- mon.write("Vie : "..vie)
- sleep(2)
- if vie == 0 then
- partiefini()
- else
- xjp, yjp = 3, 26
- aff()
- end
- end
- function partiefini()
- mon.clear()
- mon.setCursorPos(26,17)
- mon.write("Partie terminåA9e !!")
- menu()
- end
- function mort()
- if xjp > 29 and xjp < 34 and yjp == 26 then
- gameover()
- end
- end
- function info()
- print(xjp..", "..yjp)
- end
- function partie()
- vie = 3
- xjp, yjp = 3, 26
- aff()
- while true do
- id, msg = rednet.receive()
- if msg == "up" then
- saut()
- info()
- mort()
- elseif msg == "g" then
- xjp = xjp - 1
- info()
- mort()
- elseif msg == "d" then
- xjp = xjp + 1
- info()
- mort()
- elseif msg == "upg" then
- sautg()
- info()
- mort()
- elseif msg == "upd" then
- sautd()
- info()
- mort()
- elseif msg == "tp" then
- id, xco = rednet.receive()
- id, yco = rednet.receive()
- print(xco.." "..yco)
- xjp = xco
- yjp = yco
- aff()
- end
- aff()
- end
- end
- menuchoix()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement