verkolst.py 704 B

12345678910111213141516171819202122232425262728293031
  1. import datetime
  2. import cocos
  3. from .economy import Resources
  4. class Verkolst:
  5. def __init__(self):
  6. self.map = None
  7. self.date = None
  8. self.resources = Resources()
  9. self.height = 0
  10. self.width = 0
  11. def init(self, tmx_source):
  12. self.map = cocos.tiles.load('Verkolst.tmx')
  13. self.height = len(self['terrain'].cells[0])
  14. self.width = len(self['terrain'].cells)
  15. self.date = datetime.date(1278, 1, 1)
  16. self.resources.init(self)
  17. def process_turn(self):
  18. self.date += datetime.timedelta(days=1)
  19. self.resources.process_turn()
  20. def __getitem__(self, item):
  21. return self.map[item]
  22. verkolst = Verkolst()