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
651f56b0
authored
2 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
c087d118
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
my_game.py
my_game.py
View file @
651f56b0
...
...
@@ -31,9 +31,9 @@ index = 0
y
=
400
jumpState
=
"runing"
t
=
30
things
=
Block
(
bush
,
cacti
,
stone
)
road_x
=
0
mountain_x
=
0
time
=
0
while
True
:
for
event
in
pygame
.
event
.
get
():
...
...
@@ -83,14 +83,23 @@ while True:
# things.rect.x -= 8
block_list
.
add
(
things
.
image
)
time
+=
1
if
time
>
60
:
num
=
random
.
randint
(
0
,
100
)
if
num
>
40
:
things
=
Block
(
bush
,
cacti
,
stone
)
block_list
.
add
(
things
)
time
=
0
for
i
in
block_list
:
if
things
.
rect
.
x
<
0
-
things
.
rect
.
width
:
things
.
rect
.
x
-=
8
i
.
rect
.
x
-=
8
screen
.
blit
(
i
.
image
,
(
i
.
rect
.
x
,
i
.
rect
.
y
))
if
i
.
rect
.
x
<
0
-
i
.
rect
.
width
:
i
.
kill
()
screen
.
blit
(
things
.
image
,
(
things
.
rect
.
x
,
things
.
rect
.
y
))
# screen.blit(things.image, (things.rect.x, things.rect.y))
# 刷新画面
pygame
.
display
.
update
()
FPS
.
tick
(
60
)
\ No newline at end of file
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