Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson1_3
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
d09921a7
authored
Apr 15, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
5919ff9d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
Untitled-1.py.py
Untitled-1.py.py
View file @
d09921a7
...
@@ -6,6 +6,9 @@ pygame.init()
...
@@ -6,6 +6,9 @@ pygame.init()
background
=
pygame
.
image
.
load
(
'bg.png'
)
background
=
pygame
.
image
.
load
(
'bg.png'
)
right
=
pygame
.
image
.
load
(
"right.png"
)
right
=
pygame
.
image
.
load
(
"right.png"
)
food
=
pygame
.
image
.
load
(
"apple.png"
)
food
=
pygame
.
image
.
load
(
"apple.png"
)
body1
=
pygame
.
image
.
load
(
"body.png"
)
body2
=
pygame
.
image
.
load
(
"body.png"
)
body3
=
pygame
.
image
.
load
(
"body.png"
)
# 创建一个窗口
# 创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
while
True
:
while
True
:
...
@@ -15,7 +18,11 @@ while True:
...
@@ -15,7 +18,11 @@ while True:
#将背景图画上去
#将背景图画上去
screen
.
blit
(
background
,(
0
,
0
))
screen
.
blit
(
background
,(
0
,
0
))
#将蛇头画上去
#将蛇头画上去
screen
.
blit
(
right
,(
2
9
0
,
120
))
screen
.
blit
(
right
,(
2
4
0
,
120
))
#将苹果画上去
#将苹果画上去
screen
.
blit
(
food
,(
360
,
300
))
screen
.
blit
(
food
,(
360
,
300
))
#将蛇身画上去
screen
.
blit
(
body1
,(
210
,
120
))
screen
.
blit
(
body2
,(
180
,
120
))
screen
.
blit
(
body3
,(
120
,
120
))
pygame
.
display
.
update
()
pygame
.
display
.
update
()
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