Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson2_diy2
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
12568a9d
authored
Nov 12, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
ab93a618
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
3 deletions
snake.py
test.py
snake.py
View file @
12568a9d
import
pygame
import
pygame
from
pygame
import
locals
from
pygame
import
locals
pygame
.
init
()
pygame
.
init
()
screem
=
pygame
.
display
.
set_mode
((
1200
,
600
))
bg
=
pygame
.
image
.
load
(
"bg.png"
)
right
=
pygame
.
image
.
load
(
"right.png"
)
apple
=
pygame
.
image
.
load
(
"apple.png"
)
boby
=
pygame
.
image
.
load
(
"body.png"
)
left
=
pygame
.
image
.
load
(
"left.png"
)
up
=
pygame
.
image
.
load
(
"up.png"
)
down
=
pygame
.
image
.
load
(
"down.png"
)
screen
=
pygame
.
display
.
set_mode
((
660
,
480
))
while
True
:
while
True
:
for
event
in
pygame
.
event
.
get
():
for
event
in
pygame
.
event
.
get
():
#print(event)
#print(event)
if
event
.
type
==
locals
.
QUIT
:
if
event
.
type
==
locals
.
QUIT
:
exit
()
exit
()
\ No newline at end of file
screen
.
blit
(
bg
,(
0
,
0
))
screen
.
blit
(
right
,(
240
,
120
))
screen
.
blit
(
boby
,(
210
,
120
))
screen
.
blit
(
boby
,(
180
,
120
))
screen
.
blit
(
boby
,(
180
,
90
))
screen
.
blit
(
down
,(
360
,
150
))
screen
.
blit
(
boby
,(
360
,
120
))
screen
.
blit
(
boby
,(
360
,
90
))
screen
.
blit
(
boby
,(
360
,
60
))
screen
.
blit
(
up
,(
360
,
360
))
screen
.
blit
(
boby
,(
360
,
390
))
screen
.
blit
(
boby
,(
360
,
420
))
screen
.
blit
(
boby
,(
330
,
420
))
screen
.
blit
(
boby
,(
300
,
420
))
screen
.
blit
(
left
,(
390
,
300
))
screen
.
blit
(
boby
,(
420
,
300
))
screen
.
blit
(
boby
,(
450
,
300
))
screen
.
blit
(
boby
,(
480
,
300
))
screen
.
blit
(
boby
,(
510
,
300
))
screen
.
blit
(
apple
,(
330
,
300
))
pygame
.
display
.
update
()
\ No newline at end of file
test.py
0 → 100644
View file @
12568a9d
import
pygame
from
pygame
import
locals
pygame
.
init
()
bg
=
pygame
.
image
.
load
(
"bg.png"
)
right
=
pygame
.
image
.
load
(
"right.png"
)
apple
=
pygame
.
image
.
load
(
"apple.png"
)
boby
=
pygame
.
image
.
load
(
"body.png"
)
left
=
pygame
.
image
.
load
(
"left.png"
)
up
=
pygame
.
image
.
load
(
"up.png"
)
down
=
pygame
.
image
.
load
(
"down.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
(
boby
,(
210
,
120
))
screen
.
blit
(
boby
,(
180
,
120
))
screen
.
blit
(
boby
,(
180
,
90
))
screen
.
blit
(
down
,(
360
,
150
))
screen
.
blit
(
boby
,(
360
,
120
))
screen
.
blit
(
boby
,(
360
,
90
))
screen
.
blit
(
boby
,(
360
,
60
))
screen
.
blit
(
up
,(
360
,
360
))
screen
.
blit
(
boby
,(
360
,
390
))
screen
.
blit
(
boby
,(
360
,
420
))
screen
.
blit
(
boby
,(
330
,
420
))
screen
.
blit
(
boby
,(
300
,
420
))
screen
.
blit
(
left
,(
390
,
300
))
screen
.
blit
(
boby
,(
420
,
300
))
screen
.
blit
(
boby
,(
450
,
300
))
screen
.
blit
(
boby
,(
480
,
300
))
screen
.
blit
(
boby
,(
510
,
300
))
screen
.
blit
(
apple
,(
330
,
300
))
pygame
.
display
.
update
()
\ 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