BFS #17
4
Pole.py
4
Pole.py
@ -55,8 +55,8 @@ class Pole:
|
||||
def check_collision(self,mouse_x,mouse_y):
|
||||
mouse_x=math.floor(mouse_x/dCon.CUBE_SIZE)
|
||||
mouse_y=math.floor(mouse_y/dCon.CUBE_SIZE)
|
||||
if(mouse_x<20):
|
||||
if(mouse_y<12):
|
||||
if(mouse_x<dCon.NUM_X):
|
||||
if(mouse_y<dCon.NUM_Y):
|
||||
collided=self.get_slot_from_cord((mouse_x,mouse_y))
|
||||
return collided.print_status()
|
||||
return ""
|
12
Tractor.py
12
Tractor.py
@ -181,19 +181,23 @@ class Tractor:
|
||||
self.do_move_if_valid(pole,(0,0))
|
||||
|
||||
def initial_move(self,pole):
|
||||
for y in range (0,12):
|
||||
for y in range (0,dCon.NUM_Y):
|
||||
if(y%2==0):
|
||||
for x in range(0,20):
|
||||
for x in range(0,dCon.NUM_X):
|
||||
self.snake_move(pole,x,y)
|
||||
else:
|
||||
for x in range(20,0,-1):
|
||||
for x in range(dCon.NUM_X,-1,-1):
|
||||
self.snake_move(pole,x,y)
|
||||
|
||||
|
||||
def snake_move(self,pole,x,y):
|
||||
next_slot_coordinates=(x,y)
|
||||
if(self.do_move_if_valid(pole,next_slot_coordinates)):
|
||||
self.slot_hydrate_dict[(x,y)]= pole.get_slot_from_cord((x,y)).get_hydrate_stats() #Budowanie slownika slotow z poziomem nawodnienia dla traktorka
|
||||
if pole.get_slot_from_cord((x,y)).get_hydrate_stats() < 60:
|
||||
hydrateIndex = 0
|
||||
else:
|
||||
hydrateIndex = 1
|
||||
self.slot_hydrate_dict[(x,y)]= hydrateIndex #Budowanie slownika slotow z poziomem nawodnienia dla traktorka
|
||||
self.clock.tick(10)
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
|
Loading…
Reference in New Issue
Block a user