Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson10_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
d00f7717
authored
Oct 29, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
cd054447
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
my_Tetris.py
my_Tetris.py
View file @
d00f7717
...
...
@@ -9,6 +9,7 @@ grid_num_height = 25 # 纵向格子数量
FPS
=
30
number
=
0
kun
=
[
2
,
7
]
shape
=
[(
0
,
0
),(
0
,
0
),(
0
,
0
),(
0
,
0
)]
# 创建窗口
screen
=
pygame
.
display
.
set_mode
((
460
,
500
))
pygame
.
display
.
set_caption
(
"俄罗斯方块"
)
...
...
@@ -21,15 +22,18 @@ while True:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
exit
()
if
event
.
type
==
locals
.
KEYDOWN
and
kun
[
0
]
<
25
:
if
event
.
key
==
locals
.
K_LEFT
and
kun
[
1
]
>
1
:
if
event
.
type
==
locals
.
KEYDOWN
and
kun
[
0
]
<
25
:
if
event
.
key
==
locals
.
K_LEFT
and
kun
[
1
]
>
1
and
number
<
1000000000
:
kun
[
1
]
=
kun
[
1
]
-
1
if
event
.
key
==
locals
.
K_RIGHT
and
kun
[
1
]
<
15
:
if
event
.
key
==
locals
.
K_RIGHT
and
kun
[
1
]
<
15
and
number
<
1000000000
:
kun
[
1
]
=
kun
[
1
]
+
1
if
event
.
key
==
locals
.
K_DOWN
:
if
event
.
key
==
locals
.
K_DOWN
and
number
<
1000000000
:
kun
[
0
]
=
25
if
event
.
key
==
locals
.
K_UP
:
number
=
10000
if
event
.
key
==
locals
.
K_SPACE
:
if
number
>=
1000000000
:
number
=
0
else
:
number
=
1000000000
# 将背景图画上去
...
...
@@ -44,5 +48,7 @@ while True:
if
number
==
20
:
kun
[
0
]
+=
1
number
=
0
if
number
>=
1000000000
:
screen
.
blit
(
font
.
render
(
"暂停"
,
True
,(
0
,
0
,
0
)),(
90
,
200
))
pygame
.
display
.
update
()
clock
.
tick
(
FPS
)
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