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
dc4e0848
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
b2c963b0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
k.py
wuguang.py
k.py
View file @
dc4e0848
...
@@ -6,12 +6,13 @@ b=pygame.image.load('body.png')
...
@@ -6,12 +6,13 @@ b=pygame.image.load('body.png')
h
=
pygame
.
image
.
load
(
'right.png'
)
h
=
pygame
.
image
.
load
(
'right.png'
)
j
=
pygame
.
image
.
load
(
'left.png'
)
j
=
pygame
.
image
.
load
(
'left.png'
)
p
=
pygame
.
image
.
load
(
'up.png'
)
p
=
pygame
.
image
.
load
(
'up.png'
)
y
=
pygame
.
image
.
load
(
'down.png'
)
kk
=
pygame
.
image
.
load
(
'down.png'
)
a
=
pygame
.
image
.
load
(
'apple.png'
)
a
=
pygame
.
image
.
load
(
'apple.png'
)
k
=
pygame
.
time
.
Clock
()
k
=
pygame
.
time
.
Clock
()
x
,
y
=
210
,
240
x
,
y
=
210
,
240
q
=
[(
180
,
240
),(
150
,
240
),(
150
,
210
),(
x
,
y
)]
q
=
[(
180
,
240
),(
150
,
240
),(
150
,
210
),(
x
,
y
)]
setheading
=
"right"
setheading
=
"right"
snake_head
=
h
while
True
:
while
True
:
for
event
in
pygame
.
event
.
get
():
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
pygame
.
QUIT
:
if
event
.
type
==
pygame
.
QUIT
:
...
@@ -28,7 +29,7 @@ while True:
...
@@ -28,7 +29,7 @@ while True:
snake_head
=
p
snake_head
=
p
if
event
.
key
==
pygame
.
K_DOWN
and
setheading
!=
"up"
:
if
event
.
key
==
pygame
.
K_DOWN
and
setheading
!=
"up"
:
setheading
=
"down"
setheading
=
"down"
snake_head
=
y
snake_head
=
kk
if
setheading
==
"right"
:
if
setheading
==
"right"
:
x
+=
30
x
+=
30
if
setheading
==
"left"
:
if
setheading
==
"left"
:
...
@@ -38,10 +39,9 @@ while True:
...
@@ -38,10 +39,9 @@ while True:
if
setheading
==
"up"
:
if
setheading
==
"up"
:
y
-=
30
y
-=
30
s
.
blit
(
w
,(
0
,
0
))
s
.
blit
(
w
,(
0
,
0
))
x
+=
30
q
.
append
((
x
,
y
))
q
.
append
((
x
,
y
))
q
.
pop
(
0
)
q
.
pop
(
0
)
s
.
blit
(
h
,(
x
,
y
))
s
.
blit
(
snake_head
,(
x
,
y
))
for
i
in
range
(
0
,
len
(
q
)
-
1
):
for
i
in
range
(
0
,
len
(
q
)
-
1
):
s
.
blit
(
b
,
q
[
i
])
s
.
blit
(
b
,
q
[
i
])
s
.
blit
(
a
,(
180
,
180
))
s
.
blit
(
a
,(
180
,
180
))
...
...
This diff is collapsed.
Click to expand it.
wuguang.py
0 → 100644
View file @
dc4e0848
# a=[1,3,5,6]
# a[2]=a.pop(0)
# print(a)
a
=
{
'yui'
:
1
}
b
=
a
.
get
(
'yuio'
)
print
(
type
(
b
))
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