Guest User

Untitled

a guest
Oct 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import PPMaze
  4.  
  5. from gi.repository import GObject
  6. from gi.repository import Clutter
  7.  
  8. class PPGuy(Clutter.Actor):
  9. """PPGuy class - base class for some entities of the game"""
  10.  
  11. PP_STATIONARY = 1
  12. PP_UP = 2
  13. PP_DOWN = 3
  14. PP_LEFT = 4
  15. PP_RIGHT = 5
  16.  
  17. __gsignals__ = {
  18. 'collide' : (GObject.SIGNAL_RUN_LAST, None, (PPGuy,)),
  19. 'die' : (GObject.SIGNAL_RUN_LAST, None, (None,)),
  20. 'spawn' : (GObject.SIGNAL_RUN_LAST, None, (None,)),
  21. 'passing' : (GObject.SIGNAL_RUN_LAST, None, (PPMazeTileCode,)),
  22. 'maze_set' : (GObject.SIGNAL_RUN_LAST, None, (PPMaze, PPMaze,))
  23. }
  24.  
  25. def __init__(self):
  26. Clutter.Actor.__init__(self)
  27.  
  28. # Migrar para properties
  29. self.direction = PP_STATIONARY
  30. self.movement = 0.0
  31. self.speed = 100
  32. self.maze = None
  33.  
  34. self.connect("parent-set", self.parent_set_cb)
  35.  
  36. def do_collide(self, collidee):
  37. """Empty"""
  38.  
  39. def do_die(self):
  40. """Empty"""
  41.  
  42. def do_spawn(self):
  43. """Empty"""
  44.  
  45. def do_passing(self, code):
  46. """Empty"""
  47.  
  48. def parent_set_cb(self):
  49. new_maze = PPMaze()
  50. parent = self.get_parent()
  51.  
  52. if isinstance(parent, PPMaze):
  53. old_maze = self.maze
  54. self.maze = new_maze
  55.  
  56. self.emit("maze_set", new_maze, old_maze)
Add Comment
Please, Sign In to add comment