86 lines
1.7 KiB
Python
86 lines
1.7 KiB
Python
|
import pygame, sys,random
|
||
|
|
||
|
|
||
|
|
||
|
pygame.init()
|
||
|
screen = pygame.display.set_mode((1280,720))
|
||
|
|
||
|
|
||
|
|
||
|
class Uprawy:
|
||
|
rodzajUprawy="brak"
|
||
|
czyPodlac="nie"
|
||
|
czyPodacNawoz="nie"
|
||
|
stanUprawy="dobry"
|
||
|
|
||
|
marchew = Uprawy()
|
||
|
marchew.rodzajUprawy="Marchew"
|
||
|
marchew.czyPodlac="tak"
|
||
|
marchew.czyPodacNawoz="tak"
|
||
|
marchew.stanUprawy="sredni"
|
||
|
|
||
|
ziemniaki = Uprawy()
|
||
|
ziemniaki.rodzajUprawy="Ziemniak"
|
||
|
ziemniaki.czyPodlac="tak"
|
||
|
ziemniaki.czyPodacNawoz="nie"
|
||
|
ziemniaki.stanUprawy="dobry"
|
||
|
|
||
|
buraki = Uprawy()
|
||
|
buraki.rodzajUprawy="Burak"
|
||
|
buraki.czyPodlac="nie"
|
||
|
buraki.czyPodacNawoz="nie"
|
||
|
buraki.stanUprawy="bardzo dobry"
|
||
|
|
||
|
salata = Uprawy()
|
||
|
salata.rodzajUprawy="Salata"
|
||
|
salata.czyPodlac="tak"
|
||
|
salata.czyPodacNawoz="tak"
|
||
|
salata.stanUprawy="zly"
|
||
|
|
||
|
pomidory = Uprawy()
|
||
|
pomidory.rodzajUprawy="Pomidor"
|
||
|
pomidory.czyPodlac="nie"
|
||
|
pomidory.czyPodacNawoz="tak"
|
||
|
pomidory.stanUprawy="sredni"
|
||
|
|
||
|
|
||
|
image = pygame.image.load(r'C:\Users\Natalia\Desktop\unnamed.jpg')
|
||
|
x=0
|
||
|
y=0
|
||
|
white = (255, 255, 255)
|
||
|
screen.fill(white)
|
||
|
def traktor(x,y):
|
||
|
screen.blit(image, (x,y))
|
||
|
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:
|
||
|
y-=1
|
||
|
|
||
|
|
||
|
screen.fill(white)
|
||
|
traktor(x,y)
|
||
|
pygame.display.flip()
|