Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson7_diy1
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
e62d4d4c
authored
Jan 30, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
2ad8c285
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
my_game.py
my_game.py
View file @
e62d4d4c
...
...
@@ -23,6 +23,9 @@ y = 400
jumpState
=
"runing"
t
=
30
# stone_x = 1000
#障碍物随机
zhangaiwu
=
[
stone
,
cacti
,
bush
]
obstacle
=
random
.
choice
(
zhangaiwu
)
...
...
@@ -33,6 +36,7 @@ rect.x = 1000
#障碍物的高度,以道路的高度为参考,注意y坐标的正负
rect
.
y
=
500
-
rect
.
height
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
...
...
@@ -93,6 +97,9 @@ while True:
rect
.
y
=
500
-
rect
.
height
rect
.
x
-=
5
screen
.
blit
(
obstacle
,
(
rect
.
x
,
rect
.
y
))
# 刷新画面
pygame
.
display
.
update
()
FPS
.
tick
(
60
)
\ No newline at end of file
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