Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson11_diy3
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
4838add1
authored
Mar 06, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
723787b9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletions
my_Tetris.py
my_Tetris.py
View file @
4838add1
...
@@ -56,6 +56,18 @@ def check(center):
...
@@ -56,6 +56,18 @@ def check(center):
cube
=
(
cube
[
0
]
+
center
[
0
],
cube
[
1
]
+
center
[
1
])
cube
=
(
cube
[
0
]
+
center
[
0
],
cube
[
1
]
+
center
[
1
])
if
cube
[
0
]
<
1
or
cube
[
1
]
<
1
or
cube
[
0
]
>
grid_num_height
or
cube
[
1
]
>
grid_num_width
:
if
cube
[
0
]
<
1
or
cube
[
1
]
<
1
or
cube
[
0
]
>
grid_num_height
or
cube
[
1
]
>
grid_num_width
:
return
False
return
False
if
list
[
cube
[
0
]
-
1
][
cube
[
1
]
-
1
]
!=
0
:
return
False
list
=
[]
for
i
in
range
(
25
):
list
.
append
([
0
]
*
15
)
while
True
:
while
True
:
for
event
in
pygame
.
event
.
get
():
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
if
event
.
type
==
locals
.
QUIT
:
...
@@ -83,7 +95,13 @@ while True:
...
@@ -83,7 +95,13 @@ while True:
index
=
old_index
index
=
old_index
current_shape
=
shape
[
index
]
current_shape
=
shape
[
index
]
count
+=
1
count
+=
1
if
count
%
FPS
==
0
:
center
[
0
]
=
center
[
0
]
+
1
if
check
(
center
)
==
False
:
center
[
0
]
=
center
[
0
]
-
1
states
=
False
for
cube
in
current_pos
:
list
[
cube
[
0
]
-
1
][
cube
[
1
]
-
1
]
=
color
# 将背景图画上去
# 将背景图画上去
screen
.
blit
(
background
,
(
0
,
0
))
screen
.
blit
(
background
,
(
0
,
0
))
# 计算出所有小方块的行、列位置
# 计算出所有小方块的行、列位置
...
...
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