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
f8e8cce1
authored
Dec 25, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
5e4ce663
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
107 deletions
s2.py
s3.py
s4.py
snake.py
s2.py
deleted
100644 → 0
View file @
5e4ce663
#导入
import
pygame
#导入
from
pygame
import
locals
#初始化
pygame
.
init
()
#载入图片
bg
=
pygame
.
image
.
load
(
"bg.png"
)
right
=
pygame
.
image
.
load
(
"right.png"
)
food
=
pygame
.
image
.
load
(
"apple.png"
)
body
=
pygame
.
image
.
load
(
"body.png"
)
#创建屏幕
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
#无限循环
while
True
:
#事件监听
for
event
in
pygame
.
event
.
get
():
#print(event)
if
event
.
type
==
locals
.
QUIT
:
exit
()
#渲染图片,注意渲染顺序
screen
.
blit
(
bg
,(
0
,
0
))
screen
.
blit
(
right
,(
240
,
120
))
screen
.
blit
(
body
,(
210
,
120
))
screen
.
blit
(
body
,(
180
,
120
))
screen
.
blit
(
body
,(
180
,
90
))
screen
.
blit
(
food
,(
100
,
120
))
#刷新界面
pygame
.
display
.
update
()
\ No newline at end of file
s3.py
deleted
100644 → 0
View file @
5e4ce663
#导入
import
pygame
from
pygame
import
locals
#初始化
pygame
.
init
()
#加载图片
bg
=
pygame
.
image
.
load
(
"bg.png"
)
right
=
pygame
.
image
.
load
(
"right.png"
)
body
=
pygame
.
image
.
load
(
"body.png"
)
food
=
pygame
.
image
.
load
(
"apple.png"
)
#创建窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
#无限循环
while
True
:
#事件监听
for
event
in
pygame
.
event
.
get
():
#print(event)
if
event
.
type
==
locals
.
QUIT
:
exit
()
#渲染图片
screen
.
blit
(
bg
,(
0
,
0
))
screen
.
blit
(
right
,(
240
,
120
))
screen
.
blit
(
body
,(
210
,
120
))
screen
.
blit
(
body
,(
180
,
120
))
screen
.
blit
(
body
,(
180
,
90
))
screen
.
blit
(
food
,(
300
,
120
))
#刷新界面
pygame
.
display
.
update
()
s4.py
deleted
100644 → 0
View file @
5e4ce663
#导入
import
pygame
from
pygame
import
locals
#初始化
pygame
.
init
()
#加载图片
bg
=
pygame
.
image
.
load
(
"bg.png"
)
right
=
pygame
.
image
.
load
(
"right.png"
)
body
=
pygame
.
image
.
load
(
"body.png"
)
food
=
pygame
.
image
.
load
(
"apple.png"
)
#创建窗口
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
#无限循环
while
True
:
#事件监听
for
event
in
pygame
.
event
.
get
():
#print(event)
if
event
.
type
==
locals
.
QUIT
:
exit
()
#渲染图片
screen
.
blit
(
bg
,(
0
,
0
))
screen
.
blit
(
right
,(
240
,
120
))
screen
.
blit
(
body
,(
210
,
120
))
screen
.
blit
(
body
,(
180
,
120
))
screen
.
blit
(
body
,(
180
,
90
))
screen
.
blit
(
food
,(
300
,
120
))
#刷新界面
pygame
.
display
.
update
()
\ No newline at end of file
snake.py
View file @
f8e8cce1
...
@@ -10,7 +10,6 @@ right = pygame.image.load('right.png')
...
@@ -10,7 +10,6 @@ right = pygame.image.load('right.png')
food
=
pygame
.
image
.
load
(
'apple.png'
)
food
=
pygame
.
image
.
load
(
'apple.png'
)
body
=
pygame
.
image
.
load
(
'body.png'
)
body
=
pygame
.
image
.
load
(
'body.png'
)
while
True
:
while
True
:
for
event
in
pygame
.
event
.
get
():
for
event
in
pygame
.
event
.
get
():
#print(event)
#print(event)
...
...
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