aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/client.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/client/client.py b/client/client.py
index 7bded0e..9e33207 100644
--- a/client/client.py
+++ b/client/client.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import socket, json, time
import pygame
@@ -76,22 +77,22 @@ def handleControls(event, gameId):
def main():
gameInit = newGame()
- gameId = gameInit['ID']
+ gameId = gameInit['id']
up = gameInit
- initSize=len(up['SNAKE'])
+ initSize=len(up['snake'])
continuer = True
while continuer:
- afficher(ecran, up['SNAKE'], up['FOOD'])
- ecran.blit(myfont.render('Score {}'.format(len(up['SNAKE'])-initSize), False, (0, 0, 0)),(0,0))
+ afficher(ecran, up['snake'], up['food'])
+ ecran.blit(myfont.render('Score {}'.format(len(up['snake'])-initSize), False, (0, 0, 0)),(0,0))
for event in pygame.event.get():
if event.type == pygame.QUIT:
continuer = False
elif event.type == pygame.KEYDOWN:
updateTmp = handleControls(event, gameId)
print(updateTmp)
- if updateTmp != None and 'TYPE' in updateTmp:
- if updateTmp['TYPE'] != 'error':
+ if updateTmp != None and 'type' in updateTmp:
+ if updateTmp['type'] != 'error':
up = updateTmp
time.sleep(0.3)
pygame.display.flip()