From 2e75b9d4cc735fc4d01d24231286ef62378e837d Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Tue, 19 Apr 2016 23:18:18 +0200 Subject: [PATCH] Communication du score --- game/main.lua | 2 ++ game/menu.lua | 1 - game/scene6.lua | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/game/main.lua b/game/main.lua index ee58cd0..bf164e0 100644 --- a/game/main.lua +++ b/game/main.lua @@ -23,6 +23,8 @@ function love.load() require "asteroid" require "bullet" require "bird" + require "socket.http" + require "socket.url" love.graphics.setIcon( love.graphics.newImage("graphics/icon.png") ) changegamestate("menu") diff --git a/game/menu.lua b/game/menu.lua index 50c1637..a332b90 100644 --- a/game/menu.lua +++ b/game/menu.lua @@ -243,7 +243,6 @@ function menu_draw() end function menu_keypressed(key, unicode) - print('key: ' .. key .. ' → ' .. unicode) if starti == -1 then if string.len(pseudo) < 16 then if string.sub(key, 1, 2) == 'kp' then diff --git a/game/scene6.lua b/game/scene6.lua index e3bfe83..cdee7c9 100644 --- a/game/scene6.lua +++ b/game/scene6.lua @@ -107,7 +107,8 @@ function scene6_update(dt) end if starttimer >= 15.7 and starttimer -dt < 15.7 then - print("SCORE:" .. scoretot .. ":" .. pseudo) + print("SCORE|" .. scoretot .. "|" .. pseudo) + socket.http.request("http://" .. arg[2] .. "/addScore?score=" .. scoretot .. "&name=" .. socket.url.escape(pseudo)) ended = true staralpha = 1 @@ -122,8 +123,8 @@ function scene6_update(dt) end if starttimer >= 20 and starttimer -dt < 20 then - changegamestate("menu") credits:pause() + changegamestate("menu") end end -- libgit2 0.21.2