Commit 49da2094 by BellCodeEditor

save project

parent 8e282375
Showing with 5 additions and 3 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import random
pygame.init() # 初始化 pygame.init() # 初始化
score = 0 score = 0
grid_size = 20 # 格子大小 grid_size = 20 # 格子大小
...@@ -69,8 +69,10 @@ while True: ...@@ -69,8 +69,10 @@ while True:
center[1] += 1 center[1] += 1
elif event.key == locals.K_LEFT: # 向左 elif event.key == locals.K_LEFT: # 向左
if center[1] > 1: center[1] = center[1] - 1
center[1] -= 1 if check(center) == False
center[1] = center[1] + 1
elif event.key == locals.K_DOWN: # 向下 elif event.key == locals.K_DOWN: # 向下
if center[0] < 25: if center[0] < 25:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment