Zaktualizuj 'tractor.py'
This commit is contained in:
parent
c21203fb72
commit
831e599e14
18
tractor.py
18
tractor.py
@ -1,7 +1,6 @@
|
|||||||
from pygame.locals import (K_c)
|
|
||||||
|
|
||||||
from src.dimensions import *
|
from src.dimensions import *
|
||||||
from src.sprites import *
|
from src.sprites import *
|
||||||
|
from plant import *
|
||||||
|
|
||||||
|
|
||||||
class Tractor(pygame.sprite.Sprite):
|
class Tractor(pygame.sprite.Sprite):
|
||||||
@ -73,10 +72,13 @@ class Tractor(pygame.sprite.Sprite):
|
|||||||
field[self.position[0]][self.position[1]].hydrate()
|
field[self.position[0]][self.position[1]].hydrate()
|
||||||
|
|
||||||
def cut(self, field, pressed_keys):
|
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):
|
def plant(self, plant_map, plants):
|
||||||
if field.planted == 0:
|
print(plant_map[self.position[0]][self.position[1]])
|
||||||
field.planted = plant
|
plant = Plant(self.field[self.position[0]][self.position[1]], plant_map[self.position[0]][self.position[1]])
|
||||||
plant.field = field
|
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