SprytnyTraktor/tractor.py

50 lines
1.9 KiB
Python
Raw Normal View History

2021-03-21 12:40:13 +01:00
import definitions
class Tractor:
def __init__(self, amount_of_seeds, collected_plants, fertilizer, fuel, water_level, x, y):
self.amount_of_seeds = amount_of_seeds
self.collected_plants = collected_plants
2021-03-27 21:31:22 +01:00
self.fertilizer = fertilizer
2021-03-29 17:58:15 +02:00
self.fuel = fuel
self.water_level = water_level
2021-03-21 13:45:20 +01:00
self.x = x
self.y = y
2021-03-31 14:02:04 +02:00
def get_all_amount_of_seeds(self):
return self.amount_of_seeds["beetroot"] + self.amount_of_seeds["carrot"] + self.amount_of_seeds["potato"] + self.amount_of_seeds["wheat"]
def get_amount_of_seeds(self, name):
return self.amount_of_seeds[name]
def set_amount_of_seeds(self, name, value):
self.amount_of_seeds[name] = value
def get_all_collected_plants(self):
return self.collected_plants["beetroot"] + self.collected_plants["carrot"] + self.collected_plants["potato"] + self.collected_plants["wheat"]
def get_collected_plants(self, name):
return self.collected_plants[name]
def set_collected_plants(self, name, value):
self.collected_plants[name] = value
2021-03-29 17:58:15 +02:00
def get_fertilizer(self, name):
return self.fertilizer[name]
def set_fertilizer(self, name, value):
self.fertilizer[name] = value
def get_fuel(self):
return self.fuel
def set_fuel(self, fuel):
self.fuel = fuel
def get_water_level(self):
return self.water_level
def set_water_level(self, water_level):
self.water_level = water_level
2021-03-21 12:40:13 +01:00
def get_x(self):
return self.x
def set_x(self, x):
self.x = x
def get_y(self):
return self.y
def set_y(self, y):
self.y = y
def move_down(self):
self.y = self.y + definitions.BLOCK_SIZE
2021-03-21 12:40:13 +01:00
def move_left(self):
self.x = self.x - definitions.BLOCK_SIZE
2021-03-21 12:40:13 +01:00
def move_right(self):
self.x = self.x + definitions.BLOCK_SIZE
2021-03-21 12:40:13 +01:00
def move_up(self):
self.y = self.y - definitions.BLOCK_SIZE