Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import PPMaze
- from gi.repository import GObject
- from gi.repository import Clutter
- class PPGuy(Clutter.Actor):
- """PPGuy class - base class for some entities of the game"""
- PP_STATIONARY = 1
- PP_UP = 2
- PP_DOWN = 3
- PP_LEFT = 4
- PP_RIGHT = 5
- __gsignals__ = {
- 'collide' : (GObject.SIGNAL_RUN_LAST, None, (PPGuy,)),
- 'die' : (GObject.SIGNAL_RUN_LAST, None, (None,)),
- 'spawn' : (GObject.SIGNAL_RUN_LAST, None, (None,)),
- 'passing' : (GObject.SIGNAL_RUN_LAST, None, (PPMazeTileCode,)),
- 'maze_set' : (GObject.SIGNAL_RUN_LAST, None, (PPMaze, PPMaze,))
- }
- def __init__(self):
- Clutter.Actor.__init__(self)
- # Migrar para properties
- self.direction = PP_STATIONARY
- self.movement = 0.0
- self.speed = 100
- self.maze = None
- self.connect("parent-set", self.parent_set_cb)
- def do_collide(self, collidee):
- """Empty"""
- def do_die(self):
- """Empty"""
- def do_spawn(self):
- """Empty"""
- def do_passing(self, code):
- """Empty"""
- def parent_set_cb(self):
- new_maze = PPMaze()
- parent = self.get_parent()
- if isinstance(parent, PPMaze):
- old_maze = self.maze
- self.maze = new_maze
- self.emit("maze_set", new_maze, old_maze)
Add Comment
Please, Sign In to add comment