예제 #1
0
def startGame(cont=False, registry=None):
    registry = getRegistry(cont, registry)

    # create fixed sprites
    global fixedSprites
    fixedSprites = pygame.sprite.Group()
    fixedCoin = FixedCoin((27, 3))
    coinCount = CoinCount(registry.coinCount, (38, 3))
    keyCount = KeyCount(registry.keyCount, (0, 3))
    lives = Lives(2, (3, 3))
    checkpointIcon = CheckpointIcon((-11, -11))
    fixedSprites.add(fixedCoin, lives, coinCount, keyCount, checkpointIcon)

    # create player
    global player
    player = Ulmo()
    player.coinCount = coinCount
    player.keyCount = keyCount
    player.lives = lives
    player.checkpointIcon = checkpointIcon
    # create the map
    rpgMap = parser.loadRpgMap(registry.mapName)
    player.setup("ulmo", rpgMap, eventBus)
    # set the start position
    player.setTilePosition(registry.playerPosition[0],
                           registry.playerPosition[1], registry.playerLevel)

    # return the play state
    return PlayState()
예제 #2
0
def startGame(cont = False, registry = None):
    registry = getRegistry(cont, registry)
    
    # create fixed sprites
    global fixedSprites
    fixedSprites = pygame.sprite.Group()
    fixedCoin = FixedCoin((27, 3))
    coinCount = CoinCount(registry.coinCount, (38, 3))
    keyCount = KeyCount(registry.keyCount, (0, 3))
    lives = Lives(2, (3, 3))
    checkpointIcon = CheckpointIcon((-11, -11))
    fixedSprites.add(fixedCoin, lives, coinCount, keyCount, checkpointIcon)
    
    # create player
    global player
    player = Ulmo()
    player.coinCount = coinCount
    player.keyCount = keyCount
    player.lives = lives
    player.checkpointIcon = checkpointIcon
    # create the map
    rpgMap = parser.loadRpgMap(registry.mapName)
    player.setup("ulmo", rpgMap, eventBus)
    # set the start position
    player.setTilePosition(registry.playerPosition[0],
                           registry.playerPosition[1],
                           registry.playerLevel)

    # return the play state
    return PlayState()
예제 #3
0
def startGame():
    global eventBus
    eventBus = EventBus()

    # create registry
    global registry
    registry = Registry()
    eventBus.addCoinCollectedListener(registry)
    eventBus.addKeyCollectedListener(registry)
    eventBus.addDoorOpenedListener(registry)
    
    global soundHandler
    soundHandler = SoundHandler()
    eventBus.addCoinCollectedListener(soundHandler)
    eventBus.addKeyCollectedListener(soundHandler)
    eventBus.addDoorOpeningListener(soundHandler)
    eventBus.addPlayerFootstepListener(soundHandler)
    eventBus.addMapTransitionListener(soundHandler)
    eventBus.addEndGameListener(soundHandler)
    eventBus.addLifeLostListener(soundHandler)
    eventBus.addWaspZoomingListener(soundHandler)
    eventBus.addBeetleCrawlingListener(soundHandler)
    
        # create fixed sprites
    global fixedSprites
    fixedSprites = pygame.sprite.Group()
    fixedCoin = FixedCoin((27, 3))
    coinCount = CoinCount(0, (38, 3))
    keyCount = KeyCount(0, (VIEW_WIDTH - 3, 3))
    lives = Lives(2, (3, 3))
    fixedSprites.add(fixedCoin, lives, coinCount, keyCount)
    
    # create player
    global player
    player = Ulmo()
    player.coinCount = coinCount
    player.keyCount = keyCount
    player.lives = lives
    # create the map
    rpgMap = parser.loadRpgMap("central")
    player.setup("ulmo", rpgMap, eventBus)
    # set the start position
    #player.setTilePosition(2, 16, 2)
    player.setTilePosition(6, 20, 2)
    #player.setTilePosition(30, 21, 3)
    #player.setTilePosition(5, 3, 4)

    # return the play state
    return PlayState()
예제 #4
0
def startGame(cont=False):
    global eventBus
    eventBus = EventBus()

    # create registry handler
    global registryHandler
    if cont:
        registryHandler.switchToSnapshot()
    else:
        #registry = Registry("unit", (4, 6), 1)
        registry = Registry("central", (6, 22), 2)
        #registry = Registry("central", (22, 20), 3)
        #registry = Registry("east", (10, 18), 1)
        #registry = Registry("wasps", (12, 10), 5)
        registryHandler = RegistryHandler(registry)
    # grab this for later
    registry = registryHandler.registry
    # add event listeners
    eventBus.addCoinCollectedListener(registryHandler)
    eventBus.addKeyCollectedListener(registryHandler)
    eventBus.addDoorOpenedListener(registryHandler)
    eventBus.addCheckpointReachedListener(registryHandler)

    global soundHandler
    soundHandler = SoundHandler()
    eventBus.addCoinCollectedListener(soundHandler)
    eventBus.addKeyCollectedListener(soundHandler)
    eventBus.addDoorOpeningListener(soundHandler)
    eventBus.addPlayerFootstepListener(soundHandler)
    eventBus.addMapTransitionListener(soundHandler)
    eventBus.addEndGameListener(soundHandler)
    eventBus.addLifeLostListener(soundHandler)
    eventBus.addWaspZoomingListener(soundHandler)
    eventBus.addBeetleCrawlingListener(soundHandler)
    eventBus.addCheckpointReachedListener(soundHandler)
    eventBus.addPlayerFallingListener(soundHandler)

    # create fixed sprites
    global fixedSprites
    fixedSprites = pygame.sprite.Group()
    fixedCoin = FixedCoin((27, 3))
    coinCount = CoinCount(registry.coinCount, (38, 3))
    keyCount = KeyCount(registry.keyCount, (0, 3))
    lives = Lives(2, (3, 3))
    checkpointIcon = CheckpointIcon((-11, -11))
    fixedSprites.add(fixedCoin, lives, coinCount, keyCount, checkpointIcon)

    # create player
    global player
    player = Ulmo()
    player.coinCount = coinCount
    player.keyCount = keyCount
    player.lives = lives
    player.checkpointIcon = checkpointIcon
    # create the map
    rpgMap = parser.loadRpgMap(registry.mapName)
    player.setup("ulmo", rpgMap, eventBus)
    # set the start position
    player.setTilePosition(registry.playerPosition[0],
                           registry.playerPosition[1], registry.playerLevel)

    # return the play state
    return PlayState()
예제 #5
0
def startGame(cont = False):
    global eventBus
    eventBus = EventBus()

    # create registry handler
    global registryHandler
    if cont:
        registryHandler.switchToSnapshot()
    else:
        #registry = Registry("unit", (4, 6), 1)
        registry = Registry("central", (6, 22), 2)
        #registry = Registry("central", (22, 20), 3)
        #registry = Registry("east", (10, 18), 1)
        #registry = Registry("wasps", (12, 10), 5)
        registryHandler = RegistryHandler(registry)
    # grab this for later
    registry = registryHandler.registry
    # add event listeners
    eventBus.addCoinCollectedListener(registryHandler)
    eventBus.addKeyCollectedListener(registryHandler)
    eventBus.addDoorOpenedListener(registryHandler)
    eventBus.addCheckpointReachedListener(registryHandler)
    
    global soundHandler
    soundHandler = SoundHandler()
    eventBus.addCoinCollectedListener(soundHandler)
    eventBus.addKeyCollectedListener(soundHandler)
    eventBus.addDoorOpeningListener(soundHandler)
    eventBus.addPlayerFootstepListener(soundHandler)
    eventBus.addMapTransitionListener(soundHandler)
    eventBus.addEndGameListener(soundHandler)
    eventBus.addLifeLostListener(soundHandler)
    eventBus.addWaspZoomingListener(soundHandler)
    eventBus.addBeetleCrawlingListener(soundHandler)
    eventBus.addCheckpointReachedListener(soundHandler)
    eventBus.addPlayerFallingListener(soundHandler)
    
    # create fixed sprites
    global fixedSprites
    fixedSprites = pygame.sprite.Group()
    fixedCoin = FixedCoin((27, 3))
    coinCount = CoinCount(registry.coinCount, (38, 3))
    keyCount = KeyCount(registry.keyCount, (0, 3))
    lives = Lives(2, (3, 3))
    checkpointIcon = CheckpointIcon((-11, -11))
    fixedSprites.add(fixedCoin, lives, coinCount, keyCount, checkpointIcon)
    
    # create player
    global player
    player = Ulmo()
    player.coinCount = coinCount
    player.keyCount = keyCount
    player.lives = lives
    player.checkpointIcon = checkpointIcon
    # create the map
    rpgMap = parser.loadRpgMap(registry.mapName)
    player.setup("ulmo", rpgMap, eventBus)
    # set the start position
    player.setTilePosition(registry.playerPosition[0],
                           registry.playerPosition[1],
                           registry.playerLevel)

    # return the play state
    return PlayState()