Commit 9d0dcc8b by BellCodeEditor

auto save

parent 76968286
Showing with 180 additions and 11 deletions
...@@ -3,7 +3,7 @@ import pygame ...@@ -3,7 +3,7 @@ import pygame
from pygame import locals from pygame import locals
pygame.init() # 初始化 pygame.init() # 初始化
score = 0 score = 1109
grid_size = 20 # 格子大小 grid_size = 20 # 格子大小
grid_num_width = 15 # 横向格子数量 grid_num_width = 15 # 横向格子数量
grid_num_height = 25 # 纵向格子数量 grid_num_height = 25 # 纵向格子数量
...@@ -23,16 +23,7 @@ while True: ...@@ -23,16 +23,7 @@ while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
if event.type == locals.KEYDOWN:
if event.key == locals.K_RIGHT:
if center[1]<15:
center[1] += 1
elif event.key == locals.K_LEFT:
if center[1]>1:
center[1] -= 1
elif event.key == locals.K_DOWN:
if center[0]<25:
center[0] += 1
...@@ -48,3 +39,181 @@ while True: ...@@ -48,3 +39,181 @@ while True:
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
clock.tick(FPS) clock.tick(FPS)
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