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
6ae2cea0
authored
May 14, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
d06d6d1f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletions
nihao.py
snake.py
nihao.py
0 → 100644
View file @
6ae2cea0
import
turtle
def
nihao
:
\ No newline at end of file
snake.py
View file @
6ae2cea0
...
...
@@ -3,11 +3,24 @@ from pygame import locals
# 初始化pygame,为使用pygame做准备
pygame
.
init
()
background
=
pygame
.
image
.
load
(
'bg.png'
)
#背景
right
=
pygame
.
image
.
load
(
'right.png'
)
#蛇头
body
=
pygame
.
image
.
load
(
'body.png'
)
#蛇身
apple
=
pygame
.
image
.
load
(
'apple.png'
)
#苹果
# 创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
#接受到退出后结束程序
exit
()
screen
.
blit
(
background
,(
0
,
0
))
#背景
screen
.
blit
(
right
,(
180
,
120
))
#蛇头
screen
.
blit
(
body
,(
150
,
120
))
#蛇身
screen
.
blit
(
body
,(
120
,
120
))
#蛇身
screen
.
blit
(
body
,(
120
,
90
))
#蛇身
screen
.
blit
(
apple
,(
360
,
300
))
#水果
pygame
.
display
.
update
()
#刷新画面
print
(
"0"
)
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