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
@@ -23,6 +23,8 @@ function love.load() @@ -23,6 +23,8 @@ function love.load()
23 require "asteroid" 23 require "asteroid"
24 require "bullet" 24 require "bullet"
25 require "bird" 25 require "bird"
  26 + require "socket.http"
  27 + require "socket.url"
26 28
27 love.graphics.setIcon( love.graphics.newImage("graphics/icon.png") ) 29 love.graphics.setIcon( love.graphics.newImage("graphics/icon.png") )
28 changegamestate("menu") 30 changegamestate("menu")
@@ -243,7 +243,6 @@ function menu_draw() @@ -243,7 +243,6 @@ function menu_draw()
243 end 243 end
244 244
245 function menu_keypressed(key, unicode) 245 function menu_keypressed(key, unicode)
246 - print('key: ' .. key .. ' → ' .. unicode)  
247 if starti == -1 then 246 if starti == -1 then
248 if string.len(pseudo) < 16 then 247 if string.len(pseudo) < 16 then
249 if string.sub(key, 1, 2) == 'kp' then 248 if string.sub(key, 1, 2) == 'kp' then
@@ -107,7 +107,8 @@ function scene6_update(dt) @@ -107,7 +107,8 @@ function scene6_update(dt)
107 end 107 end
108 108
109 if starttimer >= 15.7 and starttimer -dt < 15.7 then 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 ended = true 112 ended = true
112 staralpha = 1 113 staralpha = 1
113 114
@@ -122,8 +123,8 @@ function scene6_update(dt) @@ -122,8 +123,8 @@ function scene6_update(dt)
122 end 123 end
123 124
124 if starttimer >= 20 and starttimer -dt < 20 then 125 if starttimer >= 20 and starttimer -dt < 20 then
125 - changegamestate("menu")  
126 credits:pause() 126 credits:pause()
  127 + changegamestate("menu")
127 end 128 end
128 end 129 end
129 130