Commit 2744f518 by BellCodeEditor

save project

parent 93ca5b77
Showing with 16 additions and 9 deletions
......@@ -22,19 +22,26 @@ while True:
if event.type==locals.QUIT:
exit()
elif event.type==locals.KEYDOWN:
if event.type==locals.K_RIGHT and sethending != 'left':
if event.key==locals.K_RIGHT and sethending != 'left':
sethending='right'
snake_head=right
if event.type==locals.K_LEFT and sethending != 'right':
if event.key==locals.K_LEFT and sethending != 'right':
sethending='left'
snake_head=left
if event.type==locals.K_RIGHT and sethending != 'left':
sethending='right'
snake_head=right
if event.type==locals.K_RIGHT and sethending != 'left':
sethending='right'
snake_head=right
x=x+30
if event.key==locals.K_UP and sethending != 'down':
sethending='up'
snake_head=up
if event.key==locals.K_DOWN and sethending != 'up':
sethending='down'
snake_head=down
if sethending=='right':
x=x+30
elif sethending=='left':
x=x-30
elif sethending=='up':
y=y-30
else:
y=y+30
position.append((x,y))
position.pop(0)
screen.blit(background,(0,0))
......
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