Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson9_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
5b603a7c
authored
Jan 13, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
602209a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
lesson9-diy4.py
score.txt
lesson9-diy4.py
View file @
5b603a7c
...
@@ -24,8 +24,8 @@ class Player(pygame.sprite.Sprite): # 悟空
...
@@ -24,8 +24,8 @@ class Player(pygame.sprite.Sprite): # 悟空
self
.
image
=
image
self
.
image
=
image
# image的get_rect()方法,可以返回pygame.Rect(0,0,图像宽,图像高)的对象
# image的get_rect()方法,可以返回pygame.Rect(0,0,图像宽,图像高)的对象
self
.
rect
=
self
.
image
.
get_rect
()
self
.
rect
=
self
.
image
.
get_rect
()
self
.
rect
.
x
=
15
0
self
.
rect
.
x
=
15
self
.
rect
.
y
=
40
0
self
.
rect
.
y
=
40
# 创建一个窗口
# 创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
1000
,
600
))
screen
=
pygame
.
display
.
set_mode
((
1000
,
600
))
...
@@ -48,7 +48,7 @@ basic_font = pygame.font.Font('STKAITI.TTF', 18) # 字体
...
@@ -48,7 +48,7 @@ basic_font = pygame.font.Font('STKAITI.TTF', 18) # 字体
index
=
0
index
=
0
y
=
400
y
=
400
jumpState
=
"runing"
jumpState
=
"runing"
t
=
35
t
=
100
road_x
=
0
road_x
=
0
bg_x
=
0
bg_x
=
0
time
=
0
time
=
0
...
@@ -92,13 +92,13 @@ while True:
...
@@ -92,13 +92,13 @@ while True:
else
:
else
:
jumpState
=
"down"
jumpState
=
"down"
if
jumpState
==
"down"
:
# 降落状态
if
jumpState
==
"down"
:
# 降落状态
if
t
<=
35
:
if
t
<=
100
:
y
+=
t
y
+=
t
wukong
.
rect
.
y
=
y
wukong
.
rect
.
y
=
y
t
+=
2
t
+=
2
else
:
else
:
jumpState
=
"runing"
jumpState
=
"runing"
t
=
35
t
=
100
# 将背景图画上去
# 将背景图画上去
bg_x
-=
1
bg_x
-=
1
...
...
score.txt
View file @
5b603a7c
{"第1名": 2, "第2名": 0, "第3名": 0}
{"第1名": 9, "第2名": 2, "第3名": 0}
\ No newline at end of file
\ No newline at end of file
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