Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson12_diy2
This project
Loading...
Sign in
Toggle navigation
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
8de9d5c4
authored
2 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
9ded14c8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
my_Tetris.py
my_Tetris.py
View file @
8de9d5c4
...
...
@@ -56,8 +56,6 @@ num_list=[]
for
i
in
range
(
25
):
num_list
.
append
([
0
]
*
15
)
def
check
(
center
):
for
cube
in
current_shape
:
if
num_list
[
cube
[
0
]
-
1
][
cube
[
1
]
-
1
]
!=
0
:
return
False
...
...
@@ -108,16 +106,18 @@ while True:
shape
=
random
.
choice
(
shape_list
)
index
=
random
.
randint
(
0
,
len
(
shape
)
-
1
)
# 随机形状索引
current_shape
=
shape
[
index
]
color
=
random
.
choice
(
cube_colors
)
# 随机选取一种颜色
color
=
random
.
choice
(
cube_colors
)
# 随机选取一种颜色
count
+=
1
if
count
%
FPS
==
0
:
# 降落速度的算式
center
[
0
]
=
center
[
0
]
+
1
print
(
check
(
center
))
if
check
(
center
)
==
False
:
center
[
0
]
=
center
[
0
]
-
1
states
=
False
for
cube
in
current_pos
:
num_list
[
cube
[
0
]
-
1
][
cube
[
1
]
-
1
]
=
color
print
(
num_list
)
# 将背景图画上去
screen
.
blit
(
background
,
(
0
,
0
))
...
...
@@ -153,7 +153,7 @@ while True:
if
tttt
==
False
:
new_list
[
row_index
]
=
num_list
[
i
]
row_index
-=
1
num_list
=
new_list
else
:
score
+=
1
num_list
=
new_list
# 得分
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment