Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson2_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
2a0eb32a
authored
Dec 09, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
6053ad0b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
27 deletions
snake.py
snake.py
View file @
2a0eb32a
落叶的位置
谱出一首诗
时间在消逝
我们的故事开始
这是第一次
让我见证爱情可以慷慨又自私
你是我的关键词
import
pygame
from
pygame
import
locals
独自走下长坂坡
月光太温柔
曹操不啰嗦
一心要拿荆州
用阴谋阳谋明说暗夺的谋
东汉末年分三国
烽火连天不休
儿女情长被乱世左右
谁来煮酒
尔虞我诈是三国
说不清对与错
纷纷扰扰千百年以后
一切又从头
exit
()
# 初始化pygame,为使用硬件做准备
pygame
.
init
()
风到了这里就是黏
黏住过客的思念
雨划过这里穿成线
穿过我们留恋人世间
你在身边就是缘
缘分写在三生石上面
\ No newline at end of file
# 创建一个窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
# 背景
background
=
pygame
.
image
.
load
(
'bg.png'
)
right
=
pygame
.
image
.
load
(
'right.png'
)
food
=
pygame
.
image
.
load
(
'apple.png'
)
right
=
pygame
.
image
.
load
(
'right.png'
)
food
=
pygame
.
image
.
load
(
'right.png'
)
while
True
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
# 接收到退出事件后退出程序
# 将背景图画上去
screen
.
blit
(
background
,
(
0
,
0
))
# 将贪吃蛇的头画上去
screen
.
blit
(
right
,
(
240
,
120
))
x
+=
30
#将果实画上去
screen
.
blit
(
background
,(
0
,
0
))
#刷新画面
screen
.
blit
(
right
,(
x
,
y
))
#将贪吃蛇的身体画上去
screen
.
blit
(
body
,(
210
,
120
))
screen
.
blit
(
bpdy
,(
180
,
120
))
screen
.
blit
(
body
,(
180
,
90
))
#将果实画上去
\ 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