Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson8_diy4
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
9f65c214
authored
Jun 17, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
5a68dac5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
my_game.py
my_game.py
View file @
9f65c214
...
@@ -54,6 +54,7 @@ while True:
...
@@ -54,6 +54,7 @@ while True:
if
jumpState
==
"runing"
:
if
jumpState
==
"runing"
:
if
event
.
key
==
locals
.
K_SPACE
:
if
event
.
key
==
locals
.
K_SPACE
:
jumpState
=
"up"
jumpState
=
"up"
spead
=
8
+
score
//
3
if
jumpState
==
"up"
:
# 起跳状态
if
jumpState
==
"up"
:
# 起跳状态
if
t
>
0
:
if
t
>
0
:
...
@@ -80,7 +81,7 @@ while True:
...
@@ -80,7 +81,7 @@ while True:
if
bg_x
<-
1000
:
if
bg_x
<-
1000
:
bg_x
=
0
bg_x
=
0
screen
.
blit
(
background
,
(
bg_x
,
0
))
# 远处背景
screen
.
blit
(
background
,
(
bg_x
,
0
))
# 远处背景
road_x
-=
8
road_x
-=
spead
if
road_x
<-
1000
:
if
road_x
<-
1000
:
road_x
=
0
road_x
=
0
screen
.
blit
(
road
,
(
road_x
,
500
))
# 路
screen
.
blit
(
road
,
(
road_x
,
500
))
# 路
...
@@ -93,6 +94,9 @@ while True:
...
@@ -93,6 +94,9 @@ while True:
if
(
sprite
.
rect
.
x
+
sprite
.
rect
.
width
)
<
wukong
.
rect
.
x
:
if
(
sprite
.
rect
.
x
+
sprite
.
rect
.
width
)
<
wukong
.
rect
.
x
:
score
+=
sprite
.
score
score
+=
sprite
.
score
sprite
.
screen
=
0
sprite
.
screen
=
0
if
score
>
old_score
:
score_audio
.
play
()
old_score
=
score
if
aa
.
rect
.
x
<=
0
-
aa
.
rect
.
width
:
# 障碍物消失
if
aa
.
rect
.
x
<=
0
-
aa
.
rect
.
width
:
# 障碍物消失
# 创建障碍物对象
# 创建障碍物对象
aa
=
Block
(
bush
,
cacti
,
stone
)
aa
=
Block
(
bush
,
cacti
,
stone
)
...
...
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