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

Administrator / pygame_lesson11_diy2

  • 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 9b1a6e9c authored 2 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

save project

parent 36c2c868
Hide whitespace changes
Inline Side-by-side
Showing with 3 additions and 3 deletions
  • my_Tetris.py
my_Tetris.py
View file @ 9b1a6e9c
...@@ -46,9 +46,9 @@ c = [ ...@@ -46,9 +46,9 @@ c = [
(153, 0, 51), (204, 255, 102), (255, 153, 0)] (153, 0, 51), (204, 255, 102), (255, 153, 0)]
center=[2,8] center=[2,8]
color=random.choice(c) color=random.choice(c)
current_shape = s[a] cu = s[a]
def check(center): def check(center):
for cube in c: for cube in cu:
cube1=(cube[0]+center[0],cube[1]+center[1]) cube1=(cube[0]+center[0],cube[1]+center[1])
if cube1[0]<1 or cube1[0]>grid_num_height or cube[1]<1 or cube1[1]>grid_num_width: if cube1[0]<1 or cube1[0]>grid_num_height or cube[1]<1 or cube1[1]>grid_num_width:
return False return False
...@@ -77,7 +77,7 @@ while True: ...@@ -77,7 +77,7 @@ while True:
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
# 计算出所有小方块的行、列位置 # 计算出所有小方块的行、列位置
current_pos = [] current_pos = []
for cube in current_shape: for cube in cu:
pos = (cube[0] + center[0], cube[1] + center[1]) pos = (cube[0] + center[0], cube[1] + center[1])
current_pos.append(pos) current_pos.append(pos)
# 取出所有小方块的行、列位置,计算坐标,绘制俄罗斯方块 # 取出所有小方块的行、列位置,计算坐标,绘制俄罗斯方块
......
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