MCPcopy Create free account
hub / github.com/ActiveState/code / snake

Function snake

recipes/Python/578996_Snake_the_game/recipe-578996.py:104–118  ·  view source on GitHub ↗
(block_size,snakeList)

Source from the content-addressed store, hash-verified

102 return randApplex,randAppley
103
104def snake(block_size,snakeList):
105
106 if direction=="right":
107 head=pygame.transform.rotate(img,270)
108 if direction=="left":
109 head=pygame.transform.rotate(img,90)
110 if direction=="up":
111 head=img
112 if direction=="down":
113 head=pygame.transform.rotate(img,180)
114
115 gameDisplay.blit(head,(snakeList[-1][0],snakeList[-1][1]))
116
117 for XnY in snakeList[:-1]:
118 pygame.draw.rect(gameDisplay, green, (XnY[0],XnY[1],block_size,block_size))
119
120def text_objects(text,color,size):
121

Callers 1

gameLoopFunction · 0.85

Calls 1

rotateMethod · 0.45

Tested by

no test coverage detected