Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson9_diy2
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
cf1d7c99
authored
Aug 15, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
4f2d856a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
my_game.py
my_game.py
View file @
cf1d7c99
...
@@ -23,7 +23,7 @@ class Player(pygame.sprite.Sprite): # 悟空
...
@@ -23,7 +23,7 @@ class Player(pygame.sprite.Sprite): # 悟空
# 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
=
150
self
.
rect
.
x
=
150
self
.
rect
.
y
=
5
00
self
.
rect
.
y
=
4
00
# 创建一个窗口
# 创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
1000
,
600
))
screen
=
pygame
.
display
.
set_mode
((
1000
,
600
))
...
@@ -40,8 +40,8 @@ hero = [pygame.image.load('hero1.png'),
...
@@ -40,8 +40,8 @@ hero = [pygame.image.load('hero1.png'),
pygame
.
image
.
load
(
'hero3.png'
),
pygame
.
image
.
load
(
'hero3.png'
),
pygame
.
image
.
load
(
'hero4.png'
),
pygame
.
image
.
load
(
'hero4.png'
),
pygame
.
image
.
load
(
'hero5.png'
)]
pygame
.
image
.
load
(
'hero5.png'
)]
basic_font
=
pygame
.
font
.
Font
(
'STKAITI.TTF'
,
32
)
basic_font
=
pygame
.
font
.
Font
(
'STKAITI.TTF'
,
18
)
s
ton
e_audio
=
pygame
.
mixer
.
Sound
(
"score.wav"
)
s
cor
e_audio
=
pygame
.
mixer
.
Sound
(
"score.wav"
)
index
=
0
index
=
0
y
=
400
y
=
400
...
@@ -79,7 +79,7 @@ while True:
...
@@ -79,7 +79,7 @@ while True:
if
t
>
0
:
if
t
>
0
:
y
-=
t
y
-=
t
wukong
.
rect
.
y
=
y
wukong
.
rect
.
y
=
y
t
-=
1
t
-=
2
else
:
else
:
jumpState
=
"down"
jumpState
=
"down"
if
jumpState
==
"down"
:
# 降落状态
if
jumpState
==
"down"
:
# 降落状态
...
...
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