Example #1
0
    def init(self, *args, **kwds):

        self.logger: Logger = getLogger(__name__)

        self._gameEngine: GameEngine = GameEngine()
        self._gameState: GameState = GameState()
        self._gameSettings: GameSettings = GameSettings()
        self._computer: Computer = Computer()
        self._intelligence: Intelligence = Intelligence()

        self._ktm: KlingonTorpedoMediator = KlingonTorpedoMediator()
        self._ctm: CommanderTorpedoMediator = CommanderTorpedoMediator()
        self._ptm: EnterpriseTorpedoMediator = EnterpriseTorpedoMediator()
        self._stm: SuperCommanderTorpedoMediator = SuperCommanderTorpedoMediator(
        )

        self._km: KlingonMediator = KlingonMediator()
        self._cm: CommanderMediator = CommanderMediator()
        self._scm: SuperCommanderMediator = SuperCommanderMediator()

        self._epm: EnterprisePhaserMediator = EnterprisePhaserMediator()

        self._messageConsole: MessageConsole = MessageConsole()
        self._soundMachine: SoundMachine = SoundMachine()

        self._playerList: SpriteList = SpriteList()
        self._klingonList: SpriteList = SpriteList()
        self._commanderList: SpriteList = SpriteList()
        self._superCommanderList: SpriteList = SpriteList()
Example #2
0
    def __init__(self):

        self.logger:        Logger       = getLogger(__name__)
        self._soundMachine: SoundMachine = SoundMachine()
        super().__init__()

        self._explosionTextures: TextureList = self._loadTorpedoExplosionTextures()
Example #3
0
    def __init__(self):

        self.logger: Logger = getLogger(__name__)
        self._soundMachine: SoundMachine = SoundMachine()
        super().__init__()

        self._torpedoes: SpriteList = SpriteList()
        self._misses: SpriteList = SpriteList()
        self._explosions: SpriteList = SpriteList()

        self._torpedoExplosionTextures: TextureList = self._loadPhotonTorpedoExplosions(
        )
Example #4
0
    def __init__(self):

        super().__init__()

        self.logger: Logger = getLogger(__name__)

        self._gameSettings: GameSettings = GameSettings()
        self._gameEngine: GameEngine = GameEngine()
        self._gameState: GameState = GameState()
        self._messageConsole: MessageConsole = MessageConsole()
        self._soundMachine: SoundMachine = SoundMachine()

        self._phaserBolts: SpriteList = SpriteList()
        self._phaserFireTextures: TextureList = self._loadFirePhaserTextures()
    def __init__(self):

        super().__init__()

        self._baseTorpedoMediatorLogger: Logger = getLogger(__name__)
        self._soundMachine: SoundMachine = SoundMachine()
        self._devices: Devices = Devices()

        self._torpedoes: SpriteList = SpriteList()
        self._explosions: SpriteList = SpriteList()
        self._torpedoFollowers: SpriteList = SpriteList(is_static=True)
        self._misses: SpriteList = SpriteList()

        self._lastTimeCheck: float = self._gameEngine.gameClock / MILLISECONDS

        self._baseTorpedoMediatorLogger.info(f'{self._lastTimeCheck=}')
    def __init__(self, view: View, warpTravelCallback: WarpTravelCallback):
        """

        Args:
            view:   The view to restore
            warpTravelCallback:
        """

        super().__init__()

        self._view:               View = view
        self._warpTravelCallback: WarpTravelCallback = warpTravelCallback

        self.logger:                  Logger       = getLogger(__name__)
        self._soundMachine:           SoundMachine = SoundMachine()
        self._warpSpeed:              float        = 0.0
        self._warpEffect:             WarpEffect   = cast(WarpEffect, None)
        self._destinationCoordinates: Coordinates = cast(Coordinates, None)
Example #7
0
    def __init__(self, screenWidth: int, screenHeight: int):

        super().__init__()

        self.logger:        Logger       = getLogger(__name__)
        self._soundMachine: SoundMachine = SoundMachine()

        self._centerPosition: tuple[float, float] = (screenWidth / 2, screenHeight / 2)

        self._warpEffectTextures: TextureList = self._loadWarpEffectTextures()
        # If you have sprite lists, you should create them here,
        # and set them to None
        self._emitter: Emitter      = cast(Emitter, None)
        self._media:   media.Player = cast(media.Player, None)

        self._playing: bool = False

        set_background_color(color.BLACK)
Example #8
0
    def setup(self):

        SettingsCommon.determineSettingsLocation()

        # self._backgroundSprite: QuadrantBackground = QuadrantBackground()

        fqFileName: str = LocateResources.getResourcesPath(resourcePackageName=LocateResources.IMAGE_RESOURCES_PACKAGE_NAME,
                                                           bareFileName='QuadrantBackground.png')
        self.background = load_texture(fqFileName)
        # Create the 'physics engine'
        # self.physicsEngine = PhysicsEngineSimple(self._enterprise, self._hardSpriteList)

        # These singletons are initialized for the first time
        self._gameSettings = GameSettings()     # Be able to read the preferences file
        self._gameState    = GameState()        # Set up the game parameters which uses the above
        self._gameEngine   = GameEngine()       # Then the engine needs to be initialized
        self._intelligence = Intelligence()
        self._computer     = Computer()
        self._galaxy       = Galaxy()           # This essentially finishes initializing most of the game

        self._messageConsole: MessageConsole = MessageConsole()
        self._eventEngine:    EventEngine    = EventEngine(self._messageConsole)

        self._statusConsole:  StatusConsole = StatusConsole(gameView=self)       # UI elements
        self._soundMachine:   SoundMachine = SoundMachine()

        self._enterprise: Enterprise = self._gameState.enterprise

        # Important mediators
        self._enterpriseMediator: EnterpriseMediator = EnterpriseMediator(view=self, warpTravelCallback=self._enterpriseHasWarped)
        self._quadrantMediator:   QuadrantMediator   = QuadrantMediator()
        self._galaxyMediator:     GalaxyMediator     = GalaxyMediator()

        self._quadrant: Quadrant = self._galaxy.currentQuadrant

        self._gameState.currentQuadrantCoordinates = self._galaxy.currentQuadrant.coordinates

        # And finally the rest of the UI elements
        self._quadrantMediator.enterQuadrant(quadrant=self._quadrant, enterprise=self._enterprise)

        self.logger.info(f'{self._enterprise=}')
        self.logger.info(f'{self._quadrant=}')
        self.logger.info(f'Setup Complete')
Example #9
0
    def __init__(self):

        super().__init__()

        self.logger: Logger = getLogger(__name__)
        self._soundMachine: SoundMachine = SoundMachine()