Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson1_2
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
502b285a
authored
Oct 22, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
5798dec2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
body.png
snake.py
body.png
View file @
502b285a
1.4 KB
|
W:
|
H:
2.52 KB
|
W:
|
H:
2-up
Swipe
Onion skin
snake.py
View file @
502b285a
import
pygame
import
pygame
from
pygame
import
locals
from
pygame
import
locals
#载入图片
background
=
pygame
.
image
.
load
(
bg
.
png
)
right
=
pygame
.
image
.
load
(
right
.
png
)
snake
=
pygame
.
image
.
load
(
snake
.
png
)
food
=
pygame
.
image
.
load
(
apple
.
png
)
#创建一个窗口
#创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
pygame
.
init
()
while
True
:
while
True
:
for
i
for
event
in
pygame
.
event
.
get
():
\ No newline at end of file
print
(
event
)
if
event
.
type
==
locals
.
QUIT
:
#接收到数据后退出程序
exit
()
#将背景画上去
screen
.
blit
(
background
,(
0
,
0
))
#将贪吃蛇的头画上去
screen
.
blit
(
right
,(
290
,
120
))
#将苹果
\ 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