base.py 1.0KB

1234567891011121314151617181920212223242526272829303132
  1. # coding: utf-8
  2. import random
  3. from sandbox.tile.gui.animation import ANIMATION_WALK
  4. from sandbox.tile.gui.animation import ANIMATION_CRAWL
  5. from synergine2_cocos2d.animation import Animate
  6. from synergine2_cocos2d.gui import TMXGui
  7. from synergine2_cocos2d.interaction import MoveActorInteraction
  8. class Game(TMXGui):
  9. def before_run(self) -> None:
  10. self.layer_manager.interaction_manager.register(MoveActorInteraction, 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))