diff --git a/tractor.py b/tractor.py index e090c10..5ee43b0 100644 --- a/tractor.py +++ b/tractor.py @@ -1,7 +1,6 @@ -from pygame.locals import (K_c) - from src.dimensions import * from src.sprites import * +from plant import * class Tractor(pygame.sprite.Sprite): @@ -73,10 +72,13 @@ class Tractor(pygame.sprite.Sprite): field[self.position[0]][self.position[1]].hydrate() def cut(self, field, pressed_keys): - if pressed_keys[K_c]: - field[self.position[0]][self.position[1]].free() + field[self.position[0]][self.position[1]].free() - def plant(self, field, plant, pressed_keys): - if field.planted == 0: - field.planted = plant - plant.field = field + def plant(self, plant_map, plants): + print(plant_map[self.position[0]][self.position[1]]) + plant = Plant(self.field[self.position[0]][self.position[1]], plant_map[self.position[0]][self.position[1]]) + plants.append(plant) + + def fertilize(self, field, plants, type): + if plants[self.position[0]][self.position[1]].species == type: + field[self.position[0]][self.position[1]].fertility = 1 \ No newline at end of file