[Python] 纯文本查看 复制代码 snake_list = [[400, 400], [420, 400], [440, 400], [460, 400], [480, 400]]
for position in snake_list:
print(position)
if event.type==pygame.KEYDOWN:
if event.key==pygame.K_UP:
direction='up'
if event.key == pygame.K_DOWN:
direction = 'down'
if event.key == pygame.K_LEFT:
direction = 'left'
if event.key == pygame.K_RIGHT:
direction = 'right'
if direction=='up':
head_x=snake_list[0][0]
head_y=snake_list[0][1]-20
head=[head_x,head_y]
snake_list,insert(0,head)
snake_list.pop()
|