Commit 6900cf3d by BellCodeEditor

save project

parent bb594f3f
Showing with 30 additions and 16 deletions
......@@ -6,26 +6,12 @@ pygame.init()
x,y = (240,120)
clock = pygame.time.Clock()
q = right
head='right'
while True:
for a in pygame.event.get():
if a.type == locals.QUIT:
exit()
if a.type == locals.K-UP and q != done
y -= 30
q = up
if a.type == locals.K-DONE and q != up
y += 30
q = done
if a.type == locals.K-RIGHT and q != left
x += 30
q = right
if a.type == locals.K-LEFT and q != right
x -= 30
q = left
clock.tick(3)
# 创建一个窗口
......@@ -39,6 +25,34 @@ while True:
body=pygame.image.load('body.png')
for a in pygame.event.get():
if a.type == locals.QUIT:
exit()
if a.type == locals.K-UP and q != 'done':
head = 'up'
q = up
if a.type == locals.K-DONE and q != 'up':
head = 'done'
q = done
if a.type == locals.K-RIGHT and q != 'left':
head = 'right'
q = right
if a.type == locals.K-LEFT and q != 'right':
head = 'left'
q = left
clock.tick(3)
if head == 'up':
y -= 30
if head == 'done':
y += 30
if head == 'right':
x += 30
if head == 'left':
x -= 30
h=[(210,120),(180,120),(180,90),(x,y)]
h.blit(bg,(0,0))
h.append((x,y))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment