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
5a1ebb0d
authored
Jan 03, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
b26ef482
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
snake.py
snake.py
View file @
5a1ebb0d
...
...
@@ -2,6 +2,15 @@ import pygame
# 初始化pygame,为使用pygame做准备
pygame
.
init
()
beijing
=
pygame
.
image
.
load
(
'bg.png'
)
#导入图片,用变量来表示
# 创建一个窗口
??
\ No newline at end of file
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
exit
()
screen
.
blit
(
beijing
,(
x
,
y
))
#blit : 渲染图片的方法,括号里面:参数1代表图片对象,参数2代表位置(x,y)来表示
#screen :就是渲染图片要渲染在哪里,代表的是游戏窗口
\ 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