base.py 1.0KB

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