le zafer lé dos

This commit is contained in:
ulrich 2019-05-11 17:48:18 +02:00
parent c709dc64e0
commit a39eedbcab
4 changed files with 112 additions and 31 deletions

View file

@ -10,7 +10,7 @@ LARGEUR_BLOCK = 10
NB_BLOCKS = 30
LARGEUR_ECRAN = LARGEUR_BLOCK * NB_BLOCKS
def connect(ip_adress, port):
def connect():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip_adress,port))
return s
@ -37,6 +37,7 @@ def update(gameId = 1, direction = None):
received = sendData(json.dumps(data))
return json.loads(received)
"""
def draw(up):
snake = []
for coords in up['SNAKE']:
@ -52,41 +53,13 @@ def draw(up):
else:
s = s + ' '
import pygame
pygame.init()
screen = pygame.display.set_mode((400, 300))
done = False
def main():
#s = connect('192.168.1.14', 8090)
gameInit = newGame()
up = update(gameInit['ID'])
"""
while True:
direction = raw_input()
up = update(gameInit['ID'], direction)
draw(up)"""
continuer = True
pygame.init()
ecran = pygame.display.set_mode((LARGEUR_ECRAN,LARGEUR_ECRAN))
while continuer:
snakeSprite = pygame.image.load("snake-sprite.png")
snakeSprite = snakeSprite.convert_alpha()
pygame.draw.rect(ecran, (0,0,90), (0,0,LARGEUR_ECRAN,LARGEUR_ECRAN))
ecran.blit(snakeSprite, (-50,0))
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
continuer = False
pygame.display.flip()
pygame.quit()
if __name__ == '__main__':
main()
draw(up)
"""