Esempio n. 1
0
def LoadPerson(element, tiles):
    """ Load a Person from a Person XML Element """
    row, column = LoadPosition(element)
    tile = tiles[row][column]
    message = element.findtext(Tags.messageTag)
    imageFilename = element.findtext(Tags.imageTag)
    if element.find(Tags.trainerTag) is not None:
        trainer = LoadTrainer(element)
        return TrainerPerson(tile, imageFilename, trainer,
                             PersonInteractionDelegate(message))
    else:
        return Person(tile, imageFilename, PersonInteractionDelegate(message))
Esempio n. 2
0
 def __init__(self, trainer, zone, row, column, doneCallback=None):
     """ Initialize the Zone Controller """
     self.zone = zone
     self.doneCallback = doneCallback
     self.zone.setCallbacks(self.handleZoneEvents)
     self.playerPerson = TrainerPerson(self.zone.tiles[row][column], "trainer", trainer, causeEnterEvents=True)
     
     screen = ZoneScreen(self.playerPerson, self.zone)
     
     cmds = {commands.UP:self.playerPerson.up,
             (commands.UP, RELEASED):self.playerPerson.stopMovingUp,
             commands.DOWN:self.playerPerson.down,
             (commands.DOWN, RELEASED):self.playerPerson.stopMovingDown,
             commands.LEFT:self.playerPerson.left,
             (commands.LEFT, RELEASED):self.playerPerson.stopMovingLeft,
             commands.RIGHT:self.playerPerson.right,
             (commands.RIGHT, RELEASED):self.playerPerson.stopMovingRight,
             commands.SELECT:self.select,
             commands.EXIT:self.runZoneMenu}
     
     PygameController.__init__(self, screen, commands=cmds)