Zaktualizuj 'tractor.py'
This commit is contained in:
parent
c21203fb72
commit
831e599e14
16
tractor.py
16
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()
|
||||
|
||||
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
|
Loading…
Reference in New Issue
Block a user