Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson3_diy1
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
3e3b8bdb
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
e4af8f1d
c95268l1354p256a13982/wx226005
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
snake.py
snake.py
View file @
3e3b8bdb
#import pygame
"""
import random
x,y=240,120
pygame.init()
po=[(180,240),(210,240),(x,y)]
g=pygame.time.Clock()
a=pygame.display.set_mode((660,480))
c=pygame.image.load("bg.png")
b=pygame.image.load("right.png")
e=pygame.image.load("body.png")
"""
ap
=
pygame
.
image
.
load
(
"apple.png"
)
b2
=
pygame
.
image
.
load
(
"up.png"
)
b3
=
pygame
.
image
.
load
(
"down.png"
)
b4
=
pygame
.
image
.
load
(
"left.png"
)
sett2
==
b
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
pygame
.
QUIT
:
o
=
random
.
randint
(
0
,
1
)
if
o
==
1
:
exit
()
else
:
continue
if
event
.
key
==
pygame
.
LEFT
and
sett2
!=
b
:
sett2
==
b4
if
event
.
key
==
pygame
.
RIGHT
and
sett2
!=
b4
:
sett2
==
b
if
event
.
key
==
pygame
.
RIGHT
and
sett2
!=
b4
:
sett2
==
b
a
.
blit
(
c
,(
0
,
0
))
a
.
blit
(
ap
,(
300
,
240
))
x
+=
30
po
.
append
((
x
,
y
))
po
.
pop
(
0
)
a
.
blit
(
b
,(
x
,
y
))
for
i
in
range
(
len
(
po
)
-
1
):
a
.
blit
(
e
,
po
[
i
])
if
x
>=
660
:
x
=
0
pygame
.
display
.
update
()
g
.
tick
(
3
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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