Zaktualizuj 'run.py'

This commit is contained in:
Natalia Wiśniewska 2020-04-07 19:57:12 +00:00
parent 6e46728174
commit fb991a0a33

19
run.py
View File

@ -1,4 +1,4 @@
import pygame, sys,random
import pygame, sys
@ -55,31 +55,18 @@ while True:
for event in pygame.event.get():
if event.type==pygame.QUIT:
sys.exit(0)
elif event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE:
x += 50
#if random.randint(1, 4)==1:
# box.x+=2
#elif random.randint(1, 4)==2:
# box.y+=2
#elif random.randint(1, 4)==3:
# box.x-=2
#elif random.randint(1, 4)==4:
# box.y-=2
if x <1200 and y==0:
x+=1
elif x==1200 and y<650:
y+=1
elif x>600 and y==650:
x-=1
elif x==600 and y>1:
y-=1
elif y==1 and 0<x<1200:
x+=1
elif x==0 and y>0:
elif x==600 and y>0:
y-=1
screen.fill(white)
traktor(x,y)
pygame.display.flip()