Commit 2e75b9d4cc735fc4d01d24231286ef62378e837d

Authored by Geoffrey PREUD'HOMME
1 parent ba814e44

Communication du score

Showing 3 changed files with 5 additions and 3 deletions   Show diff stats
game/main.lua
... ... @@ -23,6 +23,8 @@ function love.load()
23 23 require "asteroid"
24 24 require "bullet"
25 25 require "bird"
  26 + require "socket.http"
  27 + require "socket.url"
26 28  
27 29 love.graphics.setIcon( love.graphics.newImage("graphics/icon.png") )
28 30 changegamestate("menu")
... ...
game/menu.lua
... ... @@ -243,7 +243,6 @@ function menu_draw()
243 243 end
244 244  
245 245 function menu_keypressed(key, unicode)
246   - print('key: ' .. key .. ' → ' .. unicode)
247 246 if starti == -1 then
248 247 if string.len(pseudo) < 16 then
249 248 if string.sub(key, 1, 2) == 'kp' then
... ...
game/scene6.lua
... ... @@ -107,7 +107,8 @@ function scene6_update(dt)
107 107 end
108 108  
109 109 if starttimer >= 15.7 and starttimer -dt < 15.7 then
110   - print("SCORE:" .. scoretot .. ":" .. pseudo)
  110 + print("SCORE|" .. scoretot .. "|" .. pseudo)
  111 + socket.http.request("http://" .. arg[2] .. "/addScore?score=" .. scoretot .. "&name=" .. socket.url.escape(pseudo))
111 112 ended = true
112 113 staralpha = 1
113 114  
... ... @@ -122,8 +123,8 @@ function scene6_update(dt)
122 123 end
123 124  
124 125 if starttimer >= 20 and starttimer -dt < 20 then
125   - changegamestate("menu")
126 126 credits:pause()
  127 + changegamestate("menu")
127 128 end
128 129 end
129 130  
... ...