base.py 880B

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