base.py 1.2KB

12345678910111213141516171819202122232425262728293031
  1. # coding: utf-8
  2. from synergine2_cocos2d.gui import TMXGui
  3. from synergine2_cocos2d.interaction import MoveActorInteraction
  4. from synergine2_cocos2d.interaction import MoveFastActorInteraction
  5. from synergine2_cocos2d.interaction import MoveCrawlActorInteraction
  6. class Game(TMXGui):
  7. def before_run(self) -> None:
  8. self.layer_manager.interaction_manager.register(MoveActorInteraction, self.layer_manager)
  9. self.layer_manager.interaction_manager.register(MoveFastActorInteraction, self.layer_manager)
  10. self.layer_manager.interaction_manager.register(MoveCrawlActorInteraction, self.layer_manager)
  11. # Test
  12. # from sandbox.tile.gui.actor import Man
  13. # from cocos import euclid
  14. #
  15. # for i in range(10):
  16. # x = random.randint(0, 600)
  17. # y = random.randint(0, 300)
  18. # man = Man()
  19. # man.update_position(euclid.Vector2(x, y))
  20. # self.layer_manager.add_subject(man)
  21. # self.layer_manager.set_selectable(man)
  22. # man.scale = 1
  23. #
  24. # if x % 2:
  25. # man.do(Animate(ANIMATION_WALK, 10, 4))
  26. # else:
  27. # man.do(Animate(ANIMATION_CRAWL, 20, 4))