Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson7_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
4cb6e268
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
4f219b0f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
my_game.py
my_game.py
View file @
4cb6e268
...
...
@@ -23,8 +23,11 @@ jumpS = "run"
y
=
400
yy
=
30
roadx
=
0
sjx
=
600
sj
=
random
.
choice
([
stone
,
cacti
,
apple
])
rect
=
sj
.
get_rect
()
rect
.
x
=
1000
rect
.
y
=
500
-
rect
.
height
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
...
...
@@ -49,23 +52,23 @@ while True:
jumpS
=
"run"
yy
=
30
# 将背景图画上去
if
sjx
==
6
00
:
if
rect
.
x
==
10
00
:
sj
=
random
.
choice
([
stone
,
cacti
,
apple
])
rect
=
sj
.
get_rect
()
sjx
=
1000
+
rect
.
width
sj
y
=
500
-
rect
.
height
rect
.
x
=
1000
rect
.
y
=
500
-
rect
.
height
screen
.
blit
(
background
,
(
0
,
0
))
screen
.
blit
(
road
,
(
roadx
,
500
))
screen
.
blit
(
hero
[
index
],
(
150
,
y
))
screen
.
blit
(
sj
,
(
sjx
,
sj
y
))
sjx
-=
5
if
sj
x
<
0
-
rect
.
width
:
sjx
=
6
00
screen
.
blit
(
sj
,
(
rect
.
x
,
rect
.
y
))
rect
.
x
-=
8
if
rect
.
x
<
0
-
rect
.
width
:
rect
.
x
=
10
00
# 刷新画面
pygame
.
display
.
update
()
FPS
.
tick
(
4
0
)
FPS
.
tick
(
6
0
)
if
jumpS
==
"run"
:
index
=
(
index
+
1
)
%
5
roadx
-=
5
roadx
-=
8
if
roadx
==
-
1000
:
roadx
=
0
\ 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