Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / pygame_lesson11_diy4

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit e26efe26 authored 2 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

auto save

parent ecc8309e
Show whitespace changes
Inline Side-by-side
Showing with 9 additions and 7 deletions
  • my_Tetris.py
my_Tetris.py
View file @ e26efe26
...@@ -35,6 +35,7 @@ def check(): ...@@ -35,6 +35,7 @@ def check():
if cube[0]>=25: if cube[0]>=25:
center[0]-=1 center[0]-=1
break break
# 俄罗斯方块所有形状 # 俄罗斯方块所有形状
O = [[(0, 0), (0, 1), (1, 0), (1, 1)]] O = [[(0, 0), (0, 1), (1, 0), (1, 1)]]
I = [[(0, -1), (0, 0), (0, 1), (0, 2)], I = [[(0, -1), (0, 0), (0, 1), (0, 2)],
...@@ -56,13 +57,8 @@ L = [[(-1, 0), (0, 0), (1, 0), (1, 1)], ...@@ -56,13 +57,8 @@ L = [[(-1, 0), (0, 0), (1, 0), (1, 1)],
[(-1, 0), (0, 0), (1, 0), (-1, -1)], [(-1, 0), (0, 0), (1, 0), (-1, -1)],
[(0, -1), (0, 0), (0, 1), (-1, 1)]] [(0, -1), (0, 0), (0, 1), (-1, 1)]]
shape_list = [I, J, L, O, S, T, Z] # 7种类型俄罗斯方块 shape_list = [I, J, L, O, S, T, Z] # 7种类型俄罗斯方块
# 一些RGB颜色 # 一些RGB颜色
cube_colors = [ cube_colors = [(204, 153, 153), (102, 102, 153),(153, 0, 102),
(204, 153, 153), (102, 102, 153),(153, 0, 102),
(255, 204, 0), (204, 0, 51),(255, 0, 51), (0, 102, 153), (255, 204, 0), (204, 0, 51),(255, 0, 51), (0, 102, 153),
(153, 0, 51), (204, 255, 102), (255, 153, 0)] (153, 0, 51), (204, 255, 102), (255, 153, 0)]
...@@ -71,8 +67,13 @@ current_shape = [(0, -1), (0, 0), (0, 1), (-1, 0)] ...@@ -71,8 +67,13 @@ current_shape = [(0, -1), (0, 0), (0, 1), (-1, 0)]
color=random.choice(cube_colors) color=random.choice(cube_colors)
xg=random.choice(shape_list) xg=random.choice(shape_list)
fx=random.choice(xg) fx=random.choice(xg)
list_=[]
for i in range(25):
list_.append([0]*15)
print(list_)
while True: while True:
color1=color
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
...@@ -86,7 +87,8 @@ while True: ...@@ -86,7 +87,8 @@ while True:
elif event.key == locals.K_DOWN: # 向下 elif event.key == locals.K_DOWN: # 向下
if center[0] < 25: if center[0] < 25:
check() check()
if #else:
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
# 计算出所有小方块的行、列位置 # 计算出所有小方块的行、列位置
......
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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