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
a2e05b9b
authored
a year ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
e4597f7d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
my_game.py
my_game.py
View file @
a2e05b9b
...
@@ -29,9 +29,10 @@ a = 0
...
@@ -29,9 +29,10 @@ a = 0
jump
=
"runing"
jump
=
"runing"
y
=
400
y
=
400
t
=
30
t
=
30
b
=
Block
(
stone
,
cacti
,
bush
)
block_list
=
pygame
.
sprite
.
Group
()
road_x
=
0
road_x
=
0
bg_x
=
0
bg_x
=
0
time
=
0
while
True
:
while
True
:
for
event
in
pygame
.
event
.
get
():
for
event
in
pygame
.
event
.
get
():
...
@@ -71,10 +72,18 @@ while True:
...
@@ -71,10 +72,18 @@ while True:
if
a
>
4
:
if
a
>
4
:
a
=
0
a
=
0
screen
.
blit
(
wukong
,
(
150
,
y
))
screen
.
blit
(
wukong
,
(
150
,
y
))
if
b
.
rect
.
x
<
0
-
b
.
rect
.
width
:
time
+=
1
b
=
Block
(
stone
,
cacti
,
bush
)
if
time
>=
60
:
screen
.
blit
(
b
.
image
,(
b
.
rect
.
x
,
b
.
rect
.
y
))
time
=
0
b
.
rect
.
x
-=
8
num
=
random
.
randint
(
0
,
50
)
if
num
>
20
:
b
=
Block
(
stone
,
cacti
,
bush
)
block_list
.
add
(
b
)
for
sprite
in
block_list
:
sprite
.
rect
.
x
-=
8
screen
.
blit
(
sprite
.
image
,(
sprite
.
rect
.
x
,
sprite
.
rect
.
y
))
if
sprite
.
rect
.
x
<
0
-
sprite
.
rect
.
width
:
sprite
.
kill
()
# 刷新画面
# 刷新画面
pygame
.
display
.
update
()
pygame
.
display
.
update
()
FPS
.
tick
(
60
)
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