Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson8_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
24c6a984
authored
a year ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
2f508534
c238014l1412p256a14377/wx106921
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletions
my_game.py
my_game.py
View file @
24c6a984
...
...
@@ -31,7 +31,7 @@ index = 0
y
=
400
jumpState
=
"runing"
t
=
30
aa
=
Block
(
bush
,
cacti
,
stone
)
block_list
=
pygame
.
sprite
.
Group
(
)
...
...
@@ -79,8 +79,21 @@ while True:
if
obstacle
.
rect
.
x
<=
obstacle
0
-.
rect
.
width
:
# 障碍物消失
# 创建障碍物对象
obstacle
=
Block
(
bush
,
cacti
,
stone
)
obstacle
.
rect
.
x
-=
8
time
+=
1
if
time
>=
60
r
=
random
.
randint
(
0
,
100
)
if
r
>
40
:
obstacle
=
Block
(
bush
,
cacti
,
stone
)
block_list
.
add
(
obstacle
)
time
=
0
for
prop
in
block_list
:
prop
.
rect
.
x
-=
8
screen
.
blit
(
prop
.
image
,(
prop
.
rest
.
x
,
prop
.
rect
.
y
))
if
prop
.
rest
.
x
<=
0
-
prop
.
rect
.
width
screen
.
blit
(
aa
.
image
,
(
obstacle
.
rect
.
x
,
obstacle
.
rect
.
y
))
...
...
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