Exemplo n.º 1
0
    def __init__(self):
        self.loopTime, self.fpsTime, self.fps, self.deltaTime, self.playStartTime, self.playEndTime = 0, 0, 0, 0, 0, 0
        self.timer()
        self.screen = Renderer.pgRenderer(width,
                                          height,
                                          cameraDist=cameraDist,
                                          FogofWar=config.FogofWar,
                                          hudHeight=hudHeight)

        self._running = True
        self.gameWon = False
        self.keysPressed, self.keysHeld = [], []
        self.rayCaster = RayCaster.Screen(mapTools.map,
                                          width=width,
                                          height=height - hudHeight,
                                          supersampling=config.supersampling,
                                          cameraDist=cameraDist,
                                          Renderer=self.screen)

        self.player = entities.Player(position=[2.5, 5.5], direction=(1, 0))

        self.spritesOnScreen = []
        self.mobAI = entities.MobAI(
            mapTools.map)  #initialize the AI pather with the map data
        self.enemies = [
            entities.Goblin(position=[2.8, 1.4]),  #organized by rooms
            entities.ArmoredGoblin(position=[2, 2]),
            entities.Goblin(position=[2.9, 1.6]),
            entities.Goblin(position=[2, 8.4]),  #Top Right Room
            entities.Goblin(position=[7.5, 9.5]),  #Top Right end
            entities.Goblin(position=[8.5, 1.5]),  #Mid Left quarter
            entities.FastGoblin(position=[7.7, 2.3]),
            entities.Goblin(position=[9, 3.1]),
            entities.ArmoredGoblin(position=[12.5, 5.5]),  #exit room
            entities.Goblin(position=[11.5, 9.5]),  #Mid Right dead end
            entities.FastGoblin(position=[13, 9]),
            entities.Goblin(position=[12, 2]),  # Mid left passage
            entities.Goblin(position=[14.5, 1.6]),
            entities.ArmoredGoblin(position=[16, 7]),  # Big Bottom middle room
            entities.FastGoblin(position=[19, 7.2]),
            entities.Goblin(position=[20, 6.4]),
            entities.ArmoredGoblin(position=[20.5, 3.2]),  # Bottom left room
            entities.FastGoblin(position=[21.2, 2.5]),
            entities.ArmoredGoblin(
                position=[18, 9.5]),  #bottom right dead end passage
        ]
        for i in self.enemies:
            i.entityList = self.enemies

        self.gui = GUI.Hud(self.screen, self.player)

        self.soundManager = SoundEngine.SoundManager()
        self.player.walking = False
        self.enemyAttacking = False
        self.music = SoundEngine.Music(song=SoundEngine.mainTheme)