示例#1
0
class Level6Opening(SceneBase):
    def __init__(self):
        SceneBase.__init__(self)
        self.continuebutton = Button("Continue", (900, 500),
                                     self.Continue,
                                     size=(160, 60),
                                     font_size=20,
                                     bg=(109, 177, 255))

    def ProcessInput(self, events, pressed_keys):
        mousepos = pygame.mouse.get_pos()
        for event in events:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
                self.SwitchToScene(None)
            elif event.type == pygame.MOUSEBUTTONDOWN:

                if self.continuebutton.IsClicked(mousepos):
                    self.continuebutton.call_back_()

    def Update(self):
        pass

    def Render(self, screen):
        screen.fill((0, 0, 0))

        screen.blit(GetImage("./Images/level6opening.jpg"), (0, 0))

        self.continuebutton.Draw(screen)

    def Continue(self):
        print("going to final level")
        self.SwitchToScene(NeptuneGameScene())
示例#2
0
class Level1Defeat(SceneBase):
    def __init__(self):
        SceneBase.__init__(self)
        self.continuebutton = Button("Menu", (900, 500),
                                     self.Continue,
                                     size=(120, 60),
                                     font_size=20,
                                     bg=(109, 177, 255))

        b = Boombox()
        b.PlayMusic("leveldefeatmusic")

    def ProcessInput(self, events, pressed_keys):
        mousepos = pygame.mouse.get_pos()
        for event in events:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
                self.SwitchToScene(None)
            elif event.type == pygame.MOUSEBUTTONDOWN:

                if self.continuebutton.IsClicked(mousepos):
                    self.continuebutton.call_back_()

    def Update(self):
        pass

    def Render(self, screen):
        screen.fill((0, 0, 0))

        screen.blit(GetImage("./Images/level1defeat.jpg"), (0, 0))

        self.continuebutton.Draw(screen)

    def Continue(self):
        print("returning to menu scene cuz youre shit at games")
        self.SwitchToScene("Scenes.MenuScene.MenuScene")
示例#3
0
class Level1Victory(SceneBase):
    def __init__(self):
        SceneBase.__init__(self)
        self.continuebutton = Button("Continue...", (900, 500),
                                     self.Continue,
                                     size=(160, 60),
                                     font_size=20,
                                     bg=(109, 177, 255))

        b = Boombox()
        b.PlayMusic("levelvictorymusic")

    def ProcessInput(self, events, pressed_keys):
        mousepos = pygame.mouse.get_pos()
        for event in events:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
                self.SwitchToScene(None)
            elif event.type == pygame.MOUSEBUTTONDOWN:

                if self.continuebutton.IsClicked(mousepos):
                    self.continuebutton.call_back_()

    def Update(self):
        pass

    def Render(self, screen):
        screen.fill((0, 0, 0))

        screen.blit(GetImage("./Images/level1victory.jpg"), (0, 0))

        self.continuebutton.Draw(screen)

    def Continue(self):
        print("going to upgrades")
        self.SwitchToScene(MoonUpgrade())
示例#4
0
class Instructions(SceneBase):
    def __init__(self):
        SceneBase.__init__(self)
        self.returnbutton = Button("Return to Menu", (900, 425),
                                   self.GoBack,
                                   size=(300, 60),
                                   font_size=20,
                                   bg=(109, 177, 255))

    def ProcessInput(self, events, pressed_keys):
        mousepos = pygame.mouse.get_pos()
        for event in events:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
                self.SwitchToScene(None)
            elif event.type == pygame.MOUSEBUTTONDOWN:

                if self.returnbutton.IsClicked(mousepos):
                    self.returnbutton.call_back_()

    def Update(self):
        pass

    def Render(self, screen):
        screen.fill((0, 0, 0))

        screen.blit(GetImage("./Images/Instructions.jpg"), (0, 0))
        self.returnbutton.Draw(screen)

    def GoBack(self):
        print("REturning to menu")
        self.SwitchToScene("Scenes.MenuScene.MenuScene")
示例#5
0
class SpaceMongolianLoreKraymer(SceneBase):
    def __init__(self):
        SceneBase.__init__(self)
        self.backbutton = Button("Back", (900, 605),
                                 self.GoBack,
                                 size=(120, 60),
                                 font_size=20,
                                 bg=(109, 177, 255))
        self.returnbutton = Button("Menu", (900, 525),
                                   self.Return,
                                   size=(120, 60),
                                   font_size=20,
                                   bg=(109, 177, 255))

        b = Boombox()
        if not b.MusicStatus():
            b.PlayMusic("loremusic")

    def ProcessInput(self, events, pressed_keys):
        mousepos = pygame.mouse.get_pos()
        for event in events:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
                self.SwitchToScene(None)
            elif event.type == pygame.MOUSEBUTTONDOWN:

                # Check if the buttons has been pressed

                if self.backbutton.IsClicked(mousepos):
                    self.backbutton.call_back_()

                if self.returnbutton.IsClicked(mousepos):
                    self.returnbutton.call_back_()

    def Update(self):
        pass

    def Render(self, screen):
        screen.fill((0, 0, 0))

        screen.blit(GetImage("./Images/Lore/kramerlore.jpg"), (0, 0))

        self.backbutton.Draw(screen)
        self.returnbutton.Draw(screen)

    def GoBack(self):
        print("Returning to addisonlore...")
        self.SwitchToScene(
            "Scenes.Lore.SpaceMongolianLoreAddison.SpaceMongolianLoreAddison")

    def Return(self):
        print("REturning to menu scene...")
        self.SwitchToScene("Scenes.MenuScene.MenuScene")
class SpaceMongolianLoreTohnborjin(SceneBase):
    def __init__(self):
        SceneBase.__init__(self)
        self.continuebutton = Button("Continue", (900, 525),
                                     self.Continue,
                                     size=(120, 60),
                                     font_size=20,
                                     bg=(109, 177, 255))
        self.backbutton = Button("Back", (900, 605),
                                 self.GoBack,
                                 size=(120, 60),
                                 font_size=20,
                                 bg=(109, 177, 255))

        b = Boombox()
        b.PlayMusic("loremusic")

    def ProcessInput(self, events, pressed_keys):
        mousepos = pygame.mouse.get_pos()
        for event in events:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
                self.SwitchToScene(None)
            elif event.type == pygame.MOUSEBUTTONDOWN:

                # Check if the buttons has been pressed
                if self.continuebutton.IsClicked(mousepos):
                    self.continuebutton.call_back_()

                if self.backbutton.IsClicked(mousepos):
                    self.backbutton.call_back_()

    def Update(self):
        pass

    def Render(self, screen):
        screen.fill((0, 0, 0))

        screen.blit(GetImage("./Images/Lore/tohnlore.jpg"), (0, 0))

        self.continuebutton.Draw(screen)

        self.backbutton.Draw(screen)

    def Continue(self):
        print("Next Lore")
        self.SwitchToScene(SpaceMongolianLoreAndrew())

    def GoBack(self):
        self.SwitchToScene("Scenes.MenuScene.MenuScene")
示例#7
0
class NeptuneGameScene(SceneBase):
    def __init__(self):
        SceneBase.__init__(self)
        UnitLoader.__init__()

        self.counter = 0
        self.Economy = False
        self.MoneyCounter = 0
        self.AttackRate = 0
        self.EAttackRate = 0
        self.Health = 1000
        if UpgradeData.defense:
            self.EHealth = 1500
        elif not UpgradeData.defense:
            self.EHealth = 1000

        print(self.Health)

        self.offset = 0
        self.movecamera = 0
        self.scrollfactor = 25

        self.UnitMovement = UnitMovement()

        if Options.hardcoremode:
            self.AI = BaseAI(6)
        else:
            self.AI = BaseAI(3)

        self.defendbutton = Button("Defend", (60, 635),
                                   self.Attack,
                                   size=(120, 30),
                                   font_size=20,
                                   bg=(109, 177, 255))
        self.holdbutton = Button("Hold", (185, 635),
                                 self.HoldPosition,
                                 size=(120, 30),
                                 font_size=20,
                                 bg=(109, 177, 255))
        self.attackbutton = Button("Attack", (310, 635),
                                   self.DefendPosition,
                                   size=(120, 30),
                                   font_size=20,
                                   bg=(109, 177, 255))
        self.openmenu = Button("Build List", (1130, 600),
                               self.Menu,
                               size=(120, 30),
                               font_size=20,
                               bg=(109, 177, 255))

        self.resourcebar = Bar("Moon Crystals: 100", (1080, 15),
                               size=(240, 30),
                               font_size=20,
                               bg=(176, 185, 186))
        self.supplybar = Bar("Units: 0/40", (1080, 45),
                             size=(240, 30),
                             font_size=20,
                             bg=(176, 185, 186))

        self.buildmenu = ToggleMenu((1140, 350),
                                    size=(160, 400),
                                    bg=(176, 185, 186),
                                    shown=False)

        self.buildrifleblaster = Button("RifleBlaster 100", (1130, 275),
                                        self.BRB,
                                        size=(120, 60),
                                        font_size=15,
                                        bg=(109, 177, 255))
        self.buildhorserifleblaster = Button("HorseRifleBlaster 200",
                                             (1130, 435),
                                             self.BHRB,
                                             size=(120, 60),
                                             font_size=12,
                                             bg=(109, 177, 255))
        self.buildspaceraider = Button("SpaceRaider 50", (1130, 195),
                                       self.BSR,
                                       size=(120, 60),
                                       font_size=15,
                                       bg=(109, 177, 255))
        self.buildtank = Button("Tank 300", (1130, 355),
                                self.BTANK,
                                size=(120, 60),
                                font_size=15,
                                bg=(109, 177, 255))

        self.buildmenutoggle = False

        self.buildqueue = StatBar(" ", (1090, 635),
                                  size=(200, 20),
                                  bg=(176, 185, 186),
                                  fg=(109, 177, 255))

        self.basehealth = StatBar(" ", (80, 45),
                                  size=(150, 20),
                                  bg=(176, 185, 186),
                                  fg=(219, 40, 0))

        self.ebasehealth = StatBar(" ", (80, 15),
                                   size=(150, 20),
                                   bg=(176, 185, 186),
                                   fg=(109, 177, 255))

        self.text = Text(15, 80, "Base Health", bold=True, fontSize=18)

        self.etext = Text(45, 80, "Enemy Base Health", bold=True, fontSize=18)

        self.buildmenu.AddButton(self.buildhorserifleblaster)
        self.buildmenu.AddButton(self.buildrifleblaster)
        self.buildmenu.AddButton(self.buildspaceraider)
        self.buildmenu.AddButton(self.buildtank)

        b = Boombox()
        b.PlayMusic("level6playmusic")

    def ProcessInput(self, events, pressed_keys):

        mousepos = pygame.mouse.get_pos()

        for event in events:

            # Keydown events
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_RETURN:
                    self.SwitchToScene(None)

                elif event.key == pygame.K_ESCAPE:
                    print("removed")

                elif event.key == pygame.K_a:
                    self.buildqueue.SetFillPercentage(10, 100)

                elif event.key == pygame.K_b:
                    self.buildmenutoggle = not self.buildmenutoggle
                    self.buildmenu.ToggleMenu(self.buildmenutoggle)

                elif event.key == pygame.K_RIGHT:
                    if self.movecamera >= 0:
                        self.movecamera += self.scrollfactor

                elif event.key == pygame.K_LEFT:
                    if self.movecamera <= 3600:
                        self.movecamera -= self.scrollfactor

                elif event.key == pygame.K_m:
                    print("removed")

            elif event.type == pygame.KEYUP:
                if event.key == pygame.K_RIGHT:
                    if self.movecamera >= 0:
                        self.movecamera -= self.scrollfactor

                elif event.key == pygame.K_LEFT:
                    if self.movecamera <= 3600:
                        self.movecamera += self.scrollfactor

            # Mouse click events
            elif event.type == pygame.MOUSEBUTTONDOWN:

                if self.attackbutton.IsClicked(mousepos):
                    self.attackbutton.call_back_()

                elif self.defendbutton.IsClicked(mousepos):
                    self.defendbutton.call_back_()

                elif self.holdbutton.IsClicked(mousepos):
                    self.holdbutton.call_back_()

                elif self.buildhorserifleblaster.IsClicked(mousepos):
                    self.buildhorserifleblaster.call_back_()

                elif self.buildspaceraider.IsClicked(mousepos):
                    self.buildspaceraider.call_back_()

                elif self.buildtank.IsClicked(mousepos):
                    self.buildtank.call_back_()

                elif self.buildrifleblaster.IsClicked(mousepos):
                    self.buildrifleblaster.call_back_()

                elif self.openmenu.IsClicked(mousepos):
                    self.buildmenutoggle = not self.buildmenutoggle
                    self.buildmenu.ToggleMenu(self.buildmenutoggle)

    def Update(self):
        if self.movecamera != 0:
            if Camera.CheckCameraOffsets(self.offset, self.movecamera):
                self.offset += self.movecamera
                Camera.SetCameraOffset(self.offset, 0)

        self.cu = UnitLoader.GetCreatedUnits()
        self.ce = UnitSpawner.GetCreatedUnits()

        self.basehealth.SetFillPercentage(self.Health, 1000)

        self.ebasehealth.SetFillPercentage(self.EHealth, 1000)

        #Generate Money
        if (len(self.cu) > 0):
            self.Economy = True
        if (self.Economy == True):
            if (self.MoneyCounter == 60):
                self.MoneyCounter = 0
                if UpgradeData.economy:
                    CurrencyManagement.AddMoonCrystals(15)
                elif not UpgradeData.economy:
                    CurrencyManagement.AddMoonCrystals(10)

            else:
                self.MoneyCounter += 1
        if (len(self.cu) < 1):
            if (len(self.ce) < 1):
                if (self.Economy == True):
                    self.Economy = False
                    if (CurrencyManagement.GetMoonCrystals() < 100):
                        CurrencyManagement.AddMoonCrystals(
                            100 - CurrencyManagement.GetMoonCrystals())

        # Move all the units based on the current movement mode
        self.UnitMovement.MoveUnits()
        self.UnitMovement.MoveEnemyUnits()
        UnitLoader.BuildUnitsInQueue(self.buildqueue)

        # Call the AI
        self.AI.AIUpdate()

        # Move all spawned enemy units
        self.UnitMovement.MoveEnemyUnits()

        UnitSpawner.BuildUnitsInQueue()
        #You attack
        AttackDefend.UnitsAttack(self.cu, self.ce, self.AttackRate,
                                 self.EAttackRate)
        if (self.AttackRate > 50):
            self.AttackRate = 0
        else:
            self.AttackRate += 1
        if (self.EAttackRate > 50):
            self.EAttackRate = 0
        else:
            self.EAttackRate += 1
        #Attack Base
        if (self.Health != 1000):
            if (self.Health != 1500):
                if (len(self.cu) > 0):
                    self.Health = WinCon.ReachedPlayer(self.cu, 0, self.Health)
        if (self.Health == 1500):
            if (len(self.cu) > 0):
                self.Health = WinCon.ReachedPlayer(self.cu, 0, self.Health)
        if (self.Health == 1000):
            if (len(self.cu) > 0):
                self.Health = WinCon.ReachedPlayer(self.cu, 0)
        if (self.Health <= 0):
            print "Congrats you have won"
            self.SwitchToScene("Scenes.Levels.Level6Victory.Level6Victory")

        #Enemies Attack Base
        if (self.EHealth != 1000):
            if (self.EHealth != 1500):
                if (len(self.ce) > 0):
                    self.EHealth = WinCon.ReachedEPlayer(
                        self.ce, 1, self.EHealth)
        if (self.EHealth == 1000):
            if (len(self.ce) > 0):
                self.EHealth = WinCon.ReachedEPlayer(self.ce, 1)
        if (self.EHealth == 1500):
            if (len(self.ce) > 0):
                self.EHealth = WinCon.ReachedEPlayer(self.ce, 1, self.EHealth)
        if (self.EHealth <= 0):
            print "YOU LOST YOU F*****G SUCK YOU LITTLE DUMBASS"
            self.SwitchToScene("Scenes.Levels.Level6Defeat.Level6Defeat")
        #self.EHealth = WinCon.ReachedPlayer(self.ce, 1, self.EHealth)

    def Render(self, screen):
        screen.fill((0, 0, 0))

        screen.blit(GetImage("Images/Neptune.jpg"),
                    (0 - Camera.GetXOffset(), 0))

        # Draw your units on screen
        for unit in self.cu:
            topLeft = (unit.xpos - Camera.GetXOffset(), unit.ypos, unit.width,
                       unit.hight)
            bottomRight = (unit.animate.frame, 0, unit.width, unit.hight)
            if (self.UnitMovement.movementmode == "A"):
                unit.animate.nextFrame()
                screen.blit(GetImage(unit.imagepath + "walk.png"), topLeft,
                            bottomRight)
            else:
                unit.animate.prevFrame()
                screen.blit(
                    pygame.transform.flip(
                        GetImage(unit.imagepath + "walk.png"), True, False),
                    topLeft, bottomRight)
        # Draw enemy units on screen
        for unit in self.ce:
            unit.animate.prevFrame()
            topLeft = (unit.xpos - Camera.GetXOffset(), unit.ypos, unit.width,
                       unit.hight)
            bottomRight = (unit.animate.frame, 0, unit.width, unit.hight)
            screen.blit(
                pygame.transform.flip(GetImage(unit.imagepath + "walk.png"),
                                      True, False), topLeft, bottomRight)

        # Draw the GUI
        self.attackbutton.Draw(screen)
        self.holdbutton.Draw(screen)
        self.defendbutton.Draw(screen)

        # Make sure not to update the text unless it has changed
        if "Moon Crystals: " + str(
                CurrencyManagement.GetMoonCrystals()) != self.resourcebar.txt:
            self.resourcebar.SetText("Moon Crystals: " +
                                     str(CurrencyManagement.GetMoonCrystals()))

        if "Units: " + str(
                UnitLoader.GetUsedSupply()) + "/40" != self.supplybar.txt:
            self.supplybar.SetText("Units: " +
                                   str(UnitLoader.GetUsedSupply()) + "/40")

        self.resourcebar.Draw(screen)
        self.supplybar.Draw(screen)

        self.buildqueue.Draw(screen)
        self.buildmenu.Draw(screen)
        self.openmenu.Draw(screen)

        self.basehealth.Draw(screen)
        self.ebasehealth.Draw(screen)

        self.text.Draw(screen)
        self.etext.Draw(screen)

    # Cleanup function
    def Terminate(self):
        UnitLoader.createdUnits = []
        UnitLoader.queuedUnits = []
        UnitLoader.buildCount = 0
        UnitLoader.lane = 0
        UnitLoader.currentUnit = None
        CurrencyManagement.mooncrystals = 100
        UnitSpawner.createdUnits = []
        UnitSpawner.queuedUnits = []
        UnitSpawner.buildCount = 0
        UnitSpawner.lane = 0
        UnitSpawner.currentUnit = None
        Camera.SetCameraOffset(0, 0)

    # Button functions

    def DefendPosition(self):
        self.UnitMovement.SetMovementMode("A")

    def Menu(self):
        self.buildmenutoggle = not self.buildmenutoggle
        self.buildmenu.ToggleMenu(self.buildmenutoggle)

    def HoldPosition(self):
        self.UnitMovement.SetMovementMode("H")

    def Attack(self):
        self.UnitMovement.SetMovementMode("D")

    def BRB(self):
        unit = Unit(UnitLoader.units["RifleBlaster"])

        UnitLoader.EnqueueUnit(unit)

    def BHRB(self):
        unit = Unit(UnitLoader.units["HorseRifleBlaster"])

        UnitLoader.EnqueueUnit(unit)

    def BSR(self):
        unit = Unit(UnitLoader.units["SpaceRaider"])

        UnitLoader.EnqueueUnit(unit)

    def BTANK(self):
        unit = Unit(UnitLoader.units["Tank"])

        UnitLoader.EnqueueUnit(unit)
示例#8
0
class UranusUpgrade(SceneBase):
    def __init__(self):
        SceneBase.__init__(self)

        self.economybutton = Button("+5 MoonCrystals Economy", (300, 200),
                                    self.Economy,
                                    size=(240, 60),
                                    font_size=20,
                                    bg=(109, 177, 255))
        self.defensebutton = Button("+500 Mothership HP", (300, 300),
                                    self.Defense,
                                    size=(240, 60),
                                    font_size=20,
                                    bg=(109, 177, 255))

        self.continuebutton = Button("Make the Game Great Again", (900, 500),
                                     self.Continue,
                                     size=(240, 60),
                                     font_size=20,
                                     bg=(109, 177, 255))
        self.damagebutton = Button("Unit Damage +10", (300, 400),
                                   self.Damage,
                                   size=(240, 60),
                                   font_size=20,
                                   bg=(109, 177, 255))

        self.healthbutton = Button("Unit Health +20", (300, 500),
                                   self.Health,
                                   size=(240, 60),
                                   font_size=20,
                                   bg=(109, 177, 255))

        b = Boombox()

        if not b.MusicStatus():
            b.PlayMusic("menumusic")

    def ProcessInput(self, events, pressed_keys):
        global x
        mousepos = pygame.mouse.get_pos()
        for event in events:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
                self.SwitchToScene(None)

            elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
                self.SwitchToScene(None)

            elif event.type == pygame.MOUSEBUTTONDOWN:

                # Check if the buttons has been pressed
                if self.economybutton.IsClicked(
                        mousepos) and not UpgradeData.economy:
                    self.economybutton.call_back_()

                if self.defensebutton.IsClicked(
                        mousepos) and not UpgradeData.defense:
                    self.defensebutton.call_back_()

                if self.damagebutton.IsClicked(
                        mousepos) and not UpgradeData.damage:
                    self.damagebutton.call_back_()

                if self.healthbutton.IsClicked(
                        mousepos) and not UpgradeData.health:
                    self.healthbutton.call_back_()

                if self.continuebutton.IsClicked(mousepos):
                    self.continuebutton.call_back_()

    def Update(self):
        pass

    def Render(self, screen):
        global x
        screen.fill((0, 0, 0))

        screen.blit(GetImage("./Images/background.jpg"), (0, 0))

        if not UpgradeData.economy:
            self.economybutton.Draw(screen)
        if not UpgradeData.defense:
            self.defensebutton.Draw(screen)
        if not UpgradeData.damage:
            self.damagebutton.Draw(screen)
        if not UpgradeData.health:
            self.healthbutton.Draw(screen)
        self.continuebutton.Draw(screen)

    def Continue(self):
        self.SwitchToScene("Scenes.Levels.Level6Opening.Level6Opening")

    def Economy(self):
        UpgradeData.EconomyUpgrade(True)
        print("Economy upgraded")
        print(UpgradeData.economy)
        self.SwitchToScene("Scenes.Levels.Level6Opening.Level6Opening")

    def Defense(self):
        UpgradeData.DefenseUpgrade(True)
        print("Defense upgraded")
        print(UpgradeData.defense)
        self.SwitchToScene("Scenes.Levels.Level6Opening.Level6Opening")

    def Damage(self):
        UpgradeData.DamageUpgrade(True)
        print("unit damageu upgraded")
        self.SwitchToScene("Scenes.Levels.Level6Opening.Level6Opening")

    def Health(self):
        UpgradeData.HealthUpgrade(True)
        print("health damage upgraded")
        self.SwitchToScene("Scenes.Levels.Level6Opening.Level6Opening")
示例#9
0
class MenuScene(SceneBase):
    def __init__(self):
        SceneBase.__init__(self)
        self.startbutton = Button("New Game", (510, 325),
                                  self.StartGame,
                                  size=(120, 60),
                                  font_size=20,
                                  bg=(109, 177, 255))
        self.Instructionsbutton = Button("Instructions", (690, 325),
                                         self.Instructions,
                                         size=(120, 60),
                                         font_size=20,
                                         bg=(109, 177, 255))
        self.Lorebutton = Button("Read Lore", (510, 425),
                                 self.Lore,
                                 size=(120, 60),
                                 font_size=20,
                                 bg=(109, 177, 255))
        self.exitbutton = Button("Exit Game", (690, 425),
                                 self.ExitGame,
                                 size=(120, 60),
                                 font_size=20,
                                 bg=(109, 177, 255))
        self.optionsbutton = Button("Options", (1150, 625),
                                    self.Options,
                                    size=(90, 40),
                                    bg=(109, 177, 255))
        self.creditsbutton = Button("Credits", (600, 525),
                                    self.Credits,
                                    size=(120, 60),
                                    font_size=20,
                                    bg=(109, 177, 255))

        self.text = Text(
            228,
            600,
            "Mongolian Space Stick Wars XD Special Day One Edition",
            bold=True,
            color=(109, 177, 255),
            fontSize=45)

        self.text1 = Text(
            224,
            600,
            "Mongolian Space Stick Wars XD Special Day One Edition",
            bold=True,
            color=(255, 255, 255),
            font="Arial",
            fontSize=45)

        # Start music
        b = Boombox()

        b.PlayMusic("menumusic")

    def ProcessInput(self, events, pressed_keys):
        mousepos = pygame.mouse.get_pos()
        for event in events:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
                self.SwitchToScene(None)

            elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
                self.SwitchToScene(None)

            elif event.type == pygame.MOUSEBUTTONDOWN:

                # Check if the buttons has been pressed
                if self.startbutton.IsClicked(mousepos):
                    self.startbutton.call_back_()

                if self.exitbutton.IsClicked(mousepos):
                    self.exitbutton.call_back_()

                if self.Lorebutton.IsClicked(mousepos):
                    self.Lorebutton.call_back_()

                if self.optionsbutton.IsClicked(mousepos):
                    self.optionsbutton.call_back_()

                if self.Instructionsbutton.IsClicked(mousepos):
                    self.Instructionsbutton.call_back_()

                if self.creditsbutton.IsClicked(mousepos):
                    self.creditsbutton.call_back_()

    def Update(self):
        pass

    def Render(self, screen):
        screen.fill((0, 0, 0))

        screen.blit(GetImage("./Images/MoonBG1.jpg"), (0, 0))

        self.text.DrawCenter(screen)
        self.text1.DrawCenter(screen)
        self.startbutton.Draw(screen)
        self.exitbutton.Draw(screen)
        self.Lorebutton.Draw(screen)
        self.optionsbutton.Draw(screen)
        self.Instructionsbutton.Draw(screen)
        self.creditsbutton.Draw(screen)

    # Button functions
    def ExitGame(self):
        print("Exiting Game...")
        self.next = None

    def StartGame(self):
        print("Starting New Game...")
        if DLCCheck.CheckDLC():
            self.SwitchToScene(LevelSelect())
        else:
            print("[ERROR] DLC key not found")

    def Lore(self):
        print("Going to Lore...")
        self.SwitchToScene(SpaceMongolianLoreTohnborjin())

    def Options(self):
        print("Going to Options...")
        self.SwitchToScene(OptionsScene())

    def Instructions(self):
        print("Going to Instructions...")
        self.SwitchToScene(Instructions())

    def Credits(self):
        print("going to credits...")
        self.SwitchToScene(Credits())
示例#10
0
class OptionsScene(SceneBase):
    def __init__(self):
        SceneBase.__init__(self)

        self.hardcoremode = ToggleBox((600, 225),
                                      self.HardcoreMode,
                                      size=(30, 30),
                                      bg=(0, 170, 28))
        self.hardcoretext = Text(225,
                                 500,
                                 "Hardcore Mode",
                                 bold=True,
                                 font="Arial",
                                 fontSize=18)

        self.backbutton = Button("Back", (50, 625),
                                 self.GoBack,
                                 size=(60, 30),
                                 bg=(109, 177, 255))

        self.text1 = Text(100,
                          600,
                          "Options Menu",
                          bold=True,
                          color=(255, 255, 255),
                          font="Arial",
                          fontSize=35)

    def ProcessInput(self, events, pressed_keys):
        mousepos = pygame.mouse.get_pos()
        for event in events:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
                self.SwitchToScene(None)
            elif event.type == pygame.MOUSEBUTTONDOWN:

                # Check if the buttons have been pressed
                if self.hardcoremode.IsClicked(mousepos):
                    self.hardcoremode.ToggleBox()
                    self.hardcoremode.call_back()

                if self.backbutton.IsClicked(mousepos):
                    self.backbutton.call_back_()

    def Update(self):
        pass

    def Render(self, screen):
        screen.fill((0, 0, 0))

        screen.blit(GetImage("./Images/MoonBG1.jpg"), (0, 0))

        self.text1.Draw(screen)
        self.hardcoretext.Draw(screen)

        self.backbutton.Draw(screen)

        if Options.hardcoremode == True:
            self.hardcoremode.SetToggle(True)

        self.hardcoremode.Draw(screen)

    # Button functions
    def HardcoreMode(self):
        Options.SetHardcoreMode(self.hardcoremode.IsToggled())

    def GoBack(self):
        self.SwitchToScene("Scenes.MenuScene.MenuScene")
示例#11
0
class LevelSelect(SceneBase):
    def __init__(self):
        SceneBase.__init__(self)
        self.text = Text(228,
                         600,
                         "Level Select",
                         bold=True,
                         color=(109, 177, 255),
                         fontSize=45)
        self.marsbutton = Button("2. Mars", (690, 325),
                                 self.Mars,
                                 size=(120, 60),
                                 font_size=20,
                                 bg=(109, 177, 255))
        self.moonbutton = Button("1. Moon", (510, 325),
                                 self.Moon,
                                 size=(120, 60),
                                 font_size=20,
                                 bg=(109, 177, 255))
        self.saturnbutton = Button("3. Saturn", (510, 425),
                                   self.Saturn,
                                   size=(120, 60),
                                   font_size=20,
                                   bg=(109, 177, 255))
        self.mercurybutton = Button("4. Mercury", (690, 425),
                                    self.Mercury,
                                    size=(120, 60),
                                    font_size=20,
                                    bg=(109, 177, 255))

        self.uranusbutton = Button("5. Uranus", (510, 525),
                                   self.Uranus,
                                   size=(120, 60),
                                   font_size=20,
                                   bg=(109, 177, 255))
        self.neptunebutton = Button("6. Neptune", (690, 525),
                                    self.Neptune,
                                    size=(120, 60),
                                    font_size=20,
                                    bg=(109, 177, 255))

        self.continuebutton = Button("Back", (50, 625),
                                     self.Continue,
                                     size=(60, 30),
                                     bg=(109, 177, 255))
        # Start music
        b = Boombox()

        if not b.MusicStatus():
            b.PlayMusic("menumusic")

    def ProcessInput(self, events, pressed_keys):
        mousepos = pygame.mouse.get_pos()
        for event in events:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
                self.SwitchToScene(None)

            elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
                self.SwitchToScene("Scenes.MenuScene.MenuScene")

            elif event.type == pygame.MOUSEBUTTONDOWN:

                # Check if the buttons has been pressed
                if self.marsbutton.IsClicked(mousepos) and LevelData.mars:
                    self.marsbutton.call_back_()

                if self.mercurybutton.IsClicked(
                        mousepos) and LevelData.mercury:
                    self.mercurybutton.call_back_()

                if self.saturnbutton.IsClicked(mousepos) and LevelData.saturn:
                    self.saturnbutton.call_back_()

                if self.moonbutton.IsClicked(mousepos):
                    self.moonbutton.call_back_()

                if self.uranusbutton.IsClicked(mousepos) and LevelData.uranus:
                    self.uranusbutton.call_back_()

                if self.continuebutton.IsClicked(mousepos):
                    self.continuebutton.call_back_()

                if self.neptunebutton.IsClicked(
                        mousepos) and LevelData.neptune:
                    self.neptunebutton.call_back_()

    def Update(self):
        pass

    def Render(self, screen):
        screen.fill((0, 0, 0))

        screen.blit(GetImage("./Images/MoonBG1.jpg"), (0, 0))

        self.text.Draw(screen)
        if LevelData.mars:
            self.marsbutton.Draw(screen)
        if LevelData.mercury:
            self.mercurybutton.Draw(screen)
        if LevelData.saturn:
            self.saturnbutton.Draw(screen)
        self.moonbutton.Draw(screen)
        if LevelData.uranus:
            self.uranusbutton.Draw(screen)
        self.continuebutton.Draw(screen)
        if LevelData.neptune:
            self.neptunebutton.Draw(screen)

    # Button functions
    def Mercury(self):
        print("Starting New Game : Mercury...")
        self.SwitchToScene("Scenes.Levels.Level4Opening.Level4Opening")

    def Mars(self):
        print("Starting New Game : Mars...")
        self.SwitchToScene("Scenes.Levels.Level2Opening.Level2Opening")

    def Saturn(self):
        print("Starting New Game : Saturn...")
        self.SwitchToScene("Scenes.Levels.Level3Opening.Level3Opening")

    def Moon(self):
        print("Starting New Game : Moon...")
        self.SwitchToScene("Scenes.Levels.Level1Opening.Level1Opening")

    def Uranus(self):
        print("Starting New Game : Ur ANUS...")
        self.SwitchToScene("Scenes.Levels.Level5Opening.Level5Opening")

    def Neptune(self):
        print("Starting New Game : Neptune...")
        self.SwitchToScene("Scenes.Levels.Level6Opening.Level6Opening")

    def Continue(self):
        print("returning to menu")
        self.SwitchToScene("Scenes.MenuScene.MenuScene")