示例#1
0
    def Labels(self):
        self.CPCLabel = Label.Label(x=250, y=40)
        self.CPCLabel.addText(f"{handler.cookiesPerClickPrice} : cookies",
                              Arcade.FONT, "black", 32)

        self.CPSLabel = Label.Label(x=250, y=150)
        self.CPSLabel.addText(f"{handler.cookiesPerSecondsPrice} : cookies",
                              Arcade.FONT, "black", 32)
    def __init__(self, *args, **kwargs):
        super().__init__(width=175, height=70, *args, **kwargs)

        self.addBorder(2, (0, 0, 0))
        self._upgrade = None
        self._unlockedTierColor = (200, 200, 5)
        self._tierColor = (198, 198, 198)

        self._imageFrame = Frame.Frame(width=27 * 2, height=27 * 2)
        self._imageFrame.alignHorizontally(self, Arcade.ALIGN_LEFT)
        self._imageFrame.alignVertically(self, Arcade.ALIGN_TOP)
        self._imageFrame.addBorder(2, (0, 0, 0))
        self.attachGui(self._imageFrame)

        self._tierFrame = Frame.Frame(width=37 * 2, height=9 * 2)
        self._tierFrame.alignHorizontally(self, Arcade.ALIGN_LEFT)
        self._tierFrame.alignVertically(self, Arcade.ALIGN_BOTTOM)
        self.attachGui(self._tierFrame)

        self._tier1 = Frame.Frame(width=13 * 2,
                                  height=9 * 2,
                                  bgColor=self._tierColor)
        self._tier1.addBorder(2, (0, 0, 0))
        self._tier1.alignHorizontally(self._tierFrame, Arcade.ALIGN_LEFT)
        self._tier1.alignVertically(self._tierFrame, Arcade.ALIGN_CENTER)
        self.attachGui(self._tier1)

        self._tier2 = Frame.Frame(width=13 * 2,
                                  height=9 * 2,
                                  bgColor=self._tierColor)
        self._tier2.addBorder(2, (0, 0, 0))
        self._tier2.alignHorizontally(self._tierFrame, Arcade.ALIGN_CENTER)
        self._tier2.alignVertically(self._tierFrame, Arcade.ALIGN_CENTER)
        self.attachGui(self._tier2)

        self._tier3 = Frame.Frame(width=13 * 2,
                                  height=9 * 2,
                                  bgColor=self._tierColor)
        self._tier3.addBorder(2, (0, 0, 0))
        self._tier3.alignHorizontally(self._tierFrame, Arcade.ALIGN_RIGHT)
        self._tier3.alignVertically(self._tierFrame, Arcade.ALIGN_CENTER)
        self.attachGui(self._tier3)

        self._lblName = Label.Label()
        self._lblName.addText("", Arcade.FONT, (0, 0, 0), 18)
        self._lblName.alignHorizontally(self, Arcade.ALIGN_CENTER, 27)
        self._lblName.alignVertically(self, Arcade.ALIGN_CENTER, -9)

        self._lblCost = Label.Label()
        self._lblCost.addText("", Arcade.FONT, (0, 0, 0), 18)
        self._lblCost.alignHorizontally(self, Arcade.ALIGN_CENTER, 27)
        self._lblCost.alignVertically(self._lblName, Arcade.ALIGN_BOTTOM, 23)
示例#3
0
    def __init__(self):
        super().__init__()

        self._image = GUI.GUI(width=300, height=300)
        self._image.alignHorizontally(None, Arcade.ALIGN_CENTER, 200)
        self._image.alignVertically(None, Arcade.ALIGN_CENTER)
        self._image.addImage(pygame.image.load("res/images/logo.png"))

        self._frame = Frame.Frame(x=200, y=200, width=320, height=400)
        self._frame.addBorder(2, Arcade.GUI_COLOR_BLUE)
        self._frame.alignHorizontally(None, Arcade.ALIGN_CENTER, -200)
        self._frame.alignVertically(None, Arcade.ALIGN_CENTER, 20)

        self._lblTitle = Label.Label()
        self._lblTitle.addText("SIMPLE ARCADE UF", Arcade.FONT,
                               Arcade.GUI_COLOR_BLUE, 60)
        self._lblTitle.addUnderline(2, Arcade.GUI_COLOR_BLUE, -5)
        self._lblTitle.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self._lblTitle.alignVertically(None, Arcade.ALIGN_TOP, 25)

        self._lblWelcome = Label.Label()
        self._lblWelcome.addText("VÄLKOMMEN", Arcade.FONT,
                                 Arcade.GUI_COLOR_BLUE, 35)
        self._lblWelcome.addUnderline(2, Arcade.GUI_COLOR_BLUE, -5)
        self._lblWelcome.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)
        self._lblWelcome.alignVertically(self._frame, Arcade.ALIGN_TOP, 25)

        self._btnGames = Button.Button(width=270, height=50)
        self._btnGames.addText("SPEL", Arcade.FONT, Arcade.GUI_COLOR_RED, 30)
        self._btnGames.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)
        self._btnGames.alignVertically(self._frame, Arcade.ALIGN_CENTER, -50)

        self._btnHighScores = Button.Button(width=270, height=50)
        self._btnHighScores.addText("HIGHSCORES", Arcade.FONT,
                                    Arcade.GUI_COLOR_RED, 30)
        self._btnHighScores.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)
        self._btnHighScores.alignVertically(self._frame, Arcade.ALIGN_CENTER,
                                            30)

        self._btnExit = Button.Button(width=270, height=50)
        self._btnExit.addText("AVSLUTA", Arcade.FONT, Arcade.GUI_COLOR_RED, 30)
        self._btnExit.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)
        self._btnExit.alignVertically(self._frame, Arcade.ALIGN_CENTER, 110)

        self._btnGames.setNeighbors(None, self._btnHighScores, None, None)
        self._btnHighScores.setNeighbors(self._btnGames, self._btnExit, None,
                                         None)
        self._btnExit.setNeighbors(self._btnHighScores, None, None, None)

        Arcade.setSelectedGUI(self._btnGames)
示例#4
0
    def guiElements(self):
        self.HealthText = Label.Label(20, 20)
        self.HealthText.addText(f"Lives: {Handler.lives}", Arcade.FONT,
                                Arcade.WHITE, 32)

        self.LevelText = Label.Label(Arcade.SCREEN_WIDTH - 160, 20)
        self.LevelText.addText(f"Level: {Handler.level}", Arcade.FONT,
                               Arcade.WHITE, 32)

        self.LostText = Label.Label(Arcade.SCREEN_WIDTH / 2,
                                    Arcade.SCREEN_HEIGHT / 2)
        self.LostText.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.LostText.alignVertically(None, Arcade.ALIGN_CENTER)
        self.LostText.addText("GAME OVER!", Arcade.FONT, Arcade.RED, 96)
示例#5
0
    def __init__(self):
        super().__init__()

        self._lblPlay = Label.Label()
        self._lblPlay.addText("Spela", Arcade.FONT, (255, 255, 255), 70)
        self._lblPlay.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self._lblPlay.alignVertically(None, Arcade.ALIGN_CENTER, -220)

        self._lblStart = Label.Label()
        self._lblStart.addText("Starta - (knapp 1)", Arcade.FONT,
                               (255, 255, 255), 40)
        self._lblStart.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self._lblStart.alignVertically(None, Arcade.ALIGN_CENTER, -50)

        self._lblBack = Label.Label()
        self._lblBack.addText("Avsluta - (knapp 2)", Arcade.FONT,
                              (255, 255, 255), 40)
        self._lblBack.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self._lblBack.alignVertically(None, Arcade.ALIGN_CENTER, 20)

        self._lblScore = Label.Label(y=10)
        self._lblScore.addText("Score: ", Arcade.FONT, (255, 255, 255), 50)
        self._lblScore.alignHorizontally(None, Arcade.ALIGN_CENTER)

        self._lblFinalScore = Label.Label(y=130)
        self._lblFinalScore.addText("Score: 0", Arcade.FONT, (255, 255, 255),
                                    35)
        self._lblFinalScore.alignHorizontally(None, Arcade.ALIGN_CENTER)

        self._iceBergs = []
        self._started = False
        self._score = 0
        self._origIceBergSpawn = 3000
        self._origBoatSpeed = 2
        self._boatSpeed = self._origBoatSpeed
        self._lines = [27 * 4, 93 * 4, 159 * 4]
        self._currentLine = 1
        self._boat = [
            self._lines[self._currentLine], Arcade.SCREEN_HEIGHT - 220,
            Assets.boat.get_width(),
            Assets.boat.get_height()
        ]

        self._wavesAnim = Animation.Animation(
            Assets.wavesSheet.getImagesByRow(0), 800, continuous=True)
        self._wavesAnim.start()

        self._iceBergsLines = [-2 * 4, 65 * 4, 132 * 4]
        self._iceBergTimer = Timer.Timer(self._origIceBergSpawn)
示例#6
0
    def onPlay(self):
        self.gridx = Arcade.SCREEN_WIDTH / 2 - (20 * 24) / 2
        self.gridy = Arcade.SCREEN_HEIGHT / 2 - (20 * 24) / 2

        #Färger
        self.vitisch = (225, 225, 225)
        self.svart = (0, 0, 0)
        self.rod = (255, 0, 0)
        self.gron = (0, 255, 0)

        #Ormen:
        self.x = self.gridx + 200
        self.y = self.gridy + 200
        self.width = 20
        self.height = 20
        self.langdLi = 0
        self.xLista = []
        self.yLista = []
        self.svansLi = []

        #Äpplet:
        self.width2 = 10
        self.height2 = 10
        self.apple = pygame.Rect(0, 0, self.width2, self.height2)

        #Hastighet
        self.xVel = 0
        self.yVel = 0
        self.speed = 20

        self.appletfinns = False
        self.gameOver = False
        self.ifMoving = False

        self.snakeHuvud = pygame.Rect(self.gridx, self.gridy, self.width,
                                      self.height)

        self.label = Label.Label(x=self.gridx, y=self.gridy)
        self.label.addText('Game Over', Arcade.FONT, (139, 0, 0), 200)
        self.label.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.label.alignVertically(None, Arcade.ALIGN_CENTER)

        self.label2 = Label.Label(x=self.gridx, y=self.gridy - 60)
        #if Arcade.PLATFORM == Ardcade.PLATFORM_DESKTOP:
        #    self.label2.addText('Använd joysticken för att stryra', Arcade.FONT, (139, 0, 0), 50)
        #else:
        self.label2.addText('Använd piltangenterna för att styra', Arcade.FONT,
                            (139, 0, 0), 50)
示例#7
0
    def __init__(self):
        super().__init__()

        self._width = 192

        self._frame = Frame.Frame(x=Arcade.SCREEN_WIDTH-self._width, y=0, width=self._width, height=Arcade.SCREEN_HEIGHT, bgColor=(206, 170, 130))
        self._frame.addBorder(2, (0,0,0))

        self._lblSelectedName = Label.Label(y=20)
        self._lblSelectedName.addText("Allmänt", Arcade.FONT, (255,255,255), 30)
        self._lblSelectedName.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)

        self._btnStartOver = Button.Button(y=90, width=170, height=65)
        self._btnStartOver.addText("Börja om", Arcade.FONT, (255,255,255), 30)
        self._btnStartOver.addBorder(2, (0,0,0))
        self._btnStartOver.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)

        self._btnExit = Button.Button(y=190, width=170, height=65)
        self._btnExit.addText("Avsluta", Arcade.FONT, (255,255,255), 30)
        self._btnExit.addBorder(2, (0,0,0))
        self._btnExit.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)

        #Button neighbors
        self._btnStartOver.setNeighbors(None, self._btnExit, None, None)
        self._btnExit.setNeighbors(self._btnStartOver, None, None, None)

        self._selectedButton = None
示例#8
0
    def __init__(self):
        super().__init__()

        self._width = 192
        self._buttons = []

        self.addButton("Försvarare", Assets.menuButtons.getImage(0, 0))
        self.addButton("Affär", Assets.menuButtons.getImage(1, 0))
        self.addButton("Allmänt", Assets.menuButtons.getImage(2, 0))

        #Button neighbors
        self._buttons[0].setNeighbors(None, self._buttons[1], None, None)
        self._buttons[1].setNeighbors(self._buttons[0], self._buttons[2], None,
                                      None)
        self._buttons[2].setNeighbors(self._buttons[1], None, None, None)

        self._frame = Frame.Frame(x=Arcade.SCREEN_WIDTH - self._width,
                                  y=0,
                                  width=self._width,
                                  height=Arcade.SCREEN_HEIGHT,
                                  bgColor=(206, 170, 130))
        self._frame.addBorder(2, (0, 0, 0))

        self._lblSelectedName = Label.Label(y=20)
        self._lblSelectedName.addText(self._buttons[0].getLabel().getText(),
                                      Arcade.FONT, (255, 255, 255), 25)
        self._lblSelectedName.alignHorizontally(self._frame,
                                                Arcade.ALIGN_CENTER)

        self._newOpenMenuID = -1
示例#9
0
    def initGUI(self):
        self.SpaceInvadersLogo = Label.Label(x=0, y=60)
        self.SpaceInvadersLogo.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.SpaceInvadersLogo.addText("Space Invaders", Arcade.FONT,
                                       Arcade.GUI_COLOR_ORANGE, self.LOGOFONT)

        self.startBTN = Button.Button(y=215, width=250, height=50)
        self.startBTN.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.startBTN.addText("START", Arcade.FONT, Arcade.WHITE, 24)
        self.startBTN._borderColor = Arcade.BLUE

        self.leaderboardBTN = Button.Button(y=275, width=250, height=50)
        self.leaderboardBTN.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.leaderboardBTN.addText("LEADERBOARD", Arcade.FONT, Arcade.WHITE,
                                    24)
        self.leaderboardBTN._borderColor = Arcade.BLUE

        self.quitBTN = Button.Button(y=335, width=250, height=50)
        self.quitBTN.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.quitBTN.addText("QUIT", Arcade.FONT, Arcade.WHITE, 24)
        self.quitBTN._borderColor = Arcade.BLUE

        Arcade.setSelectedGUI(self.startBTN)
        self.startBTN.setNeighbors(None, self.leaderboardBTN, None, None)
        self.leaderboardBTN.setNeighbors(self.startBTN, self.quitBTN, None,
                                         None)
        self.quitBTN.setNeighbors(self.leaderboardBTN, None, None, None)
示例#10
0
    def update_player_gui(self, screen):
        self.kill_label = Label.Label(x=0, y=0)
        self.kill_label.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.kill_label.alignVertically(None, Arcade.ALIGN_CENTER)
        self.kill_label.addText(str(Handler.kill_counter), Arcade.FONT,
                                Arcade.LIGHT_BLACK_OFF, 175)

        self.kill_label.update(screen)
示例#11
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._lblText = Label.Label()
        self._lblText.addHighlightedText(Arcade.GUI_COLOR_ORANGE)
        self._lblText.alignHorizontally(self, Arcade.ALIGN_CENTER)
        self._lblText.alignVertically(self, Arcade.ALIGN_CENTER)

        self.addBorder(2, Arcade.GUI_COLOR_RED)
        self.addHighlightedBorder(Arcade.GUI_COLOR_ORANGE)

        self.attachGui(self._lblText)
    def __init__(self):
        super().__init__()

        self._btnSave1 = Button.Button(width=200, height=200)
        self._btnSave1.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self._btnSave1.alignVertically(None, Arcade.ALIGN_CENTER)
        self._btnSave1.addText("Save 1", Arcade.FONT, Arcade.GUI_COLOR_BLUE,
                               70)

        self._lblTitle = Label.Label(y=20)
        self._lblTitle.addText("Escape", Arcade.FONT, (255, 255, 255), 90)
        self._lblTitle.alignHorizontally(None, Arcade.ALIGN_CENTER)
示例#13
0
    def __init__(self):
        super().__init__()

        self._btnMap1 = Button.Button(width=250, height=200)
        self._btnMap1.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self._btnMap1.alignVertically(None, Arcade.ALIGN_CENTER)
        self._btnMap1.addText("Vanilla", Arcade.FONT, Arcade.GUI_COLOR_BLUE,
                              60)

        self._lblTitle = Label.Label(y=20)
        self._lblTitle.addText("Bloons", Arcade.FONT, (255, 255, 255), 90)
        self._lblTitle.alignHorizontally(None, Arcade.ALIGN_CENTER)
示例#14
0
    def __init__(self):

        self._lblWave = Label.Label(x=10, y=10)
        self._lblWave.addText("", Arcade.FONT, (50, 50, 70), 60)
        self._lblWave.addUnderline(4, (50, 50, 70), offset=-8)

        self._lblHealth = Label.Label(x=10, y=90)
        self._lblHealth.addText("Liv: ", Arcade.FONT, (50, 50, 70), 30)

        self._lblMoney = Label.Label(x=10, y=125)
        self._lblMoney.addText("Pengar: ", Arcade.FONT, (50, 50, 70), 30)

        self._startWaveMessage = False
        self._newWaveMessage = False
        self._lblNewWaveNumber = Label.Label(y=180)
        self._lblNewWaveNumber.alignHorizontally(None, Arcade.ALIGN_CENTER,
                                                 -100)
        self._lblNewWaveNumber.addText("0", Arcade.FONT, (30, 130, 130), 70)
        self._lblNewWaveNumber.addUnderline(4, (30, 130, 130), offset=-10)

        self._lblNewWave = Label.Label(y=270)
        self._lblNewWave.alignHorizontally(None, Arcade.ALIGN_CENTER, -100)
        self._lblNewWave.addText("Grattis! Du har klarat en ny nivå.",
                                 Arcade.FONT, (30, 30, 30), 32)

        self._lblNewWaveInfo = Label.Label(y=325)
        self._lblNewWaveInfo.alignHorizontally(None, Arcade.ALIGN_CENTER, -100)
        self._lblNewWaveInfo.addText("Tryck (knapp 3) för att börja nästa.",
                                     Arcade.FONT, (50, 50, 50), 28)
示例#15
0
    def onPlay(self):
        self._player1 = pygame.Rect(15, 200, 5, 70)
        self._player2 = pygame.Rect(Arcade.SCREEN_WIDTH - 20, 200, 5, 70)
        self._playerSpeed = 5
        self._player1Score = 0
        self._player2Score = 0
        self._maxScore = 5  #TO DO
        self._ball = pygame.Rect(40, 200, 10, 10)
        self._ballSpeed = 8
        self._ballVx = self._ballSpeed
        self._ballVy = 0
        self._ballY = 200

        self._lblScore = Label.Label(y=20)
        self._lblScore.addText("0 : 0", Arcade.FONT, (255, 255, 255), 80)
        self._lblScore.alignHorizontally(None, Arcade.ALIGN_CENTER)

        self._started = False

        self._lblTitle = Label.Label(y=30)
        self._lblTitle.addText("Spela", Arcade.FONT, (255, 255, 255), 60)
        self._lblTitle.alignHorizontally(None, Arcade.ALIGN_CENTER)
示例#16
0
    def __init__(self):

        #Main frame
        self.Main_frame = Frame.Frame(x=0, y=200, width=500, height=300)
        self.Main_frame.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.Main_frame.updateAttachedGuis(True)

        #subframe top
        self.Sub_frame_top = Frame.Frame(x=0, y=200, width=500, height=150)
        self.Sub_frame_top.alignVertically(self.Main_frame, Arcade.ALIGN_TOP)
        self.Sub_frame_top.alignHorizontally(self.Main_frame,
                                             Arcade.ALIGN_CENTER)
        self.Sub_frame_top.updateAttachedGuis(True)

        #subframe bottom
        self.Sub_frame_bottom = Frame.Frame(x=0, y=350, width=500, height=150)
        self.Sub_frame_bottom.alignVertically(self.Main_frame,
                                              Arcade.ALIGN_BOTTOM)
        self.Sub_frame_bottom.alignHorizontally(self.Main_frame,
                                                Arcade.ALIGN_CENTER)
        self.Sub_frame_bottom.updateAttachedGuis(True)

        #Main menu label
        self.Label = Label.Label(x=0, y=10)
        self.Label.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.Label.addText("GeoRush", Arcade.FONT, "white", 100)

        #Main menu button | Start
        self.B_START = Button.Button(x=0, y=0, width=120, height=60)
        self.B_START.alignHorizontally(self.Sub_frame_top, Arcade.ALIGN_CENTER)
        self.B_START.alignVertically(self.Sub_frame_top, Arcade.ALIGN_CENTER)
        self.B_START.addText("Start", Arcade.FONT, "white", 20)

        #Main menu button | Quit
        self.B_QUIT = Button.Button(x=0, y=30, width=120, height=60)
        self.B_QUIT.alignHorizontally(self.Sub_frame_bottom,
                                      Arcade.ALIGN_CENTER)
        self.B_QUIT.alignVertically(self.Sub_frame_bottom, Arcade.ALIGN_TOP)
        self.B_QUIT.addText("Quit", Arcade.FONT, "white", 20)

        self.Main_frame.attachGui(self.Sub_frame_top)
        self.Main_frame.attachGui(self.Sub_frame_bottom)

        self.Sub_frame_top.attachGui(self.B_START)
        self.Sub_frame_bottom.attachGui(self.B_QUIT)

        Arcade.setSelectedGUI(self.B_START)
        self.B_START.setNeighbors(None, self.B_QUIT, None, None)
        self.B_QUIT.setNeighbors(self.B_START, None, None, None)
示例#17
0
    def __init__(self):
        super().__init__()

        self._width = 0

        self._boughtDefenderCost = 0
        self._hasBoughtDefender = False
        self._boughtDefender = None

        self._buttons = []
        self._defenders = []

        self.addButton(Monkey.Monkey(0, 0, use=False),
                       Assets.shopSlots.getImage(0, 0), 170)
        self.addButton(Cannon.Cannon(0, 0, use=False),
                       Assets.shopSlots.getImage(1, 0), 350)
        self.addButton(IceMonkey.IceMonkey(0, 0, use=False),
                       Assets.shopSlots.getImage(2, 0), 250)
        self.addButton(Monkey.Monkey(0, 0, use=False),
                       Assets.shopSlots.getImage(0, 0), 200)
        self.addButton(Monkey.Monkey(0, 0, use=False),
                       Assets.shopSlots.getImage(0, 0), 210)
        self.addButton(Monkey.Monkey(0, 0, use=False),
                       Assets.shopSlots.getImage(0, 0), 210)

        self._selectedButton = self._buttons[0]
        self.assignButtonNeighbors()

        self._frame = Frame.Frame(x=Arcade.SCREEN_WIDTH - self._width,
                                  y=0,
                                  width=self._width,
                                  height=Arcade.SCREEN_HEIGHT,
                                  bgColor=(206, 170, 130))
        self._frame.addBorder(2, (0, 0, 0))

        self._lblSelectedName = Label.Label(y=20)
        self._lblSelectedName.addText(self._defenders[0].getName(),
                                      Arcade.FONT, (255, 255, 255), 30)
        self._lblSelectedName.alignHorizontally(self._frame,
                                                Arcade.ALIGN_CENTER)
示例#18
0
    def update(self, screen):

        screen.fill((30, 30, 30))

        self.time_label = Label.Label(x=0, y=5)
        self.time_label.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.time_label.alignVertically(None, Arcade.ALIGN_CENTER, offset=-180)
        self.time_label.addText(str(int(self.timer / 1000)), Arcade.FONT,
                                Arcade.LIGHT_BLACK_OFF, 36)

        # self.level_label = Label.Label(x=0,y=5)
        # self.level_label.alignHorizontally(None, Arcade.ALIGN_CENTER, offset=-90)
        # self.level_label.alignVertically(None, Arcade.ALIGN_CENTER, offset=90)
        # self.level_label.addText(str("1"), Arcade.FONT, Arcade.LIGHT_BLACK_OFF, 32)

        if Handler.game_over == False:

            #timer
            self.timer = (time.time() - self.game_called) * 1000

            #update
            self.player_group.update()
            self.enemy_group.update(self.player_sprite)
            self.player_sprite.update_player_gui(screen)
            self.time_label.update(screen)
            Handler.bullets.update(screen)
            # self.level_label.update(screen)

            #draw
            self.player_group.draw(screen)
            self.enemy_group.draw(screen)
            Handler.all_sprites.draw(screen)

        #game over screen
        if Handler.game_over == True:

            self.game_over_label = Label.Label(x=0, y=0)
            self.game_over_label.alignHorizontally(None, Arcade.ALIGN_CENTER)
            self.game_over_label.alignVertically(None,
                                                 Arcade.ALIGN_CENTER,
                                                 offset=-30)
            self.game_over_label.addText("Game Over", Arcade.FONT,
                                         Arcade.WHITE, 100)

            self.score_label = Label.Label(x=0, y=0)
            self.score_label.alignHorizontally(None, Arcade.ALIGN_CENTER)
            self.score_label.alignVertically(None,
                                             Arcade.ALIGN_CENTER,
                                             offset=40)
            self.score_label.addText(
                "Score : " + str(
                    int(Handler.kill_counter /
                        ((self.timer / 1000) / 100) + Handler.kill_counter)),
                Arcade.FONT, Arcade.WHITE, 32)

            self.image = pygame.Surface((600, 360), pygame.SRCALPHA)
            self.image_polygon = pygame.draw.polygon(
                self.image, pygame.Color(Arcade.STEELBLUE2), [(0, 0),
                                                              (600, 180),
                                                              (0, 360)])
            self.rotated_image = pygame.transform.rotate(self.image, 5)

            self.bg_polygon = Frame.Frame(x=0,
                                          y=0,
                                          width=int(600 * 1.3),
                                          height=int(360 * 1.1))
            self.bg_polygon.alignHorizontally(None,
                                              Arcade.ALIGN_CENTER,
                                              offset=40)
            self.bg_polygon.alignVertically(None,
                                            Arcade.ALIGN_CENTER,
                                            offset=-10)
            self.bg_polygon.addImage(self.rotated_image)

            self.bg_polygon.update(screen)
            self.game_over_label.update(screen)
            self.score_label.update(screen)
示例#19
0
 def gui(self, screen):
     self.cookiesLabel = Label.Label(x=0,y=10)
     self.cookiesLabel.alignHorizontally(None, Arcade.ALIGN_LEFT)
     self.cookiesLabel.addText(f" Cookies: {handler.cookies}", Arcade.FONT, "black", 32)
     self.cookiesLabel.update(screen)
示例#20
0
    def onPlay(self):
        ###Setting Vars and EddePie settings
        #Import sprites
        gameSpriteSheet = SpriteSheet.SpriteSheet(
            "games/Faestone/Spritesheets/Normal.png", 16)
        gameSpriteSheet.scaleImages(64 * gameScale)
        #Map Tiles
        self.grassTile1 = gameSpriteSheet.getImage(0, 1)  #ID:1
        #
        self.grassTile2 = gameSpriteSheet.getImage(1, 1)
        #
        self.grassTile3 = gameSpriteSheet.getImage(2, 1)
        #
        self.grassTile4 = gameSpriteSheet.getImage(3, 1)
        #
        self.stoneTile1 = gameSpriteSheet.getImage(0, 2)  #ID: 2
        #
        self.stoneTile2 = gameSpriteSheet.getImage(1, 2)
        #
        self.stoneTile3 = gameSpriteSheet.getImage(2, 2)
        #
        self.stoneTile4 = gameSpriteSheet.getImage(3, 2)  #ID:3

        self.bushTile = gameSpriteSheet.getImage(2, 3)
        #
        self.campFire1 = gameSpriteSheet.getImage(1, 4)  #ID: 4
        #
        self.campFire2 = gameSpriteSheet.getImage(2, 4)
        #
        self.campFire3 = gameSpriteSheet.getImage(3, 4)
        #
        self.unlitCampfire = gameSpriteSheet.getImage(0, 4)  #ID: 5
        #
        self.unopenedChest = gameSpriteSheet.getImage(1, 3)  #ID: 6
        #
        self.openedChest = gameSpriteSheet.getImage(0, 3)  #ID: 7
        #
        self.caveExit = gameSpriteSheet.getImage(3, 2)  #ID: 8
        #
        self.darkness = gameSpriteSheet.getImage(
            2, 0)  #darkness for darkness purposes  ##OLD
        #self.darkness=pygame.image.load("games/Faestone/Spritesheets/darkness.png")  ##NEW
        self.darkness = pygame.transform.scale(
            self.darkness, (int(320 * gameScale), int(320 * gameScale)))
        ##Characters
        #kobold
        self.koboldSprite = gameSpriteSheet.getImage(0, 0)
        #ranger
        self.rangerSprite = gameSpriteSheet.getImage(1, 0)
        #///#

        #creating player from class
        self.player = PlayerCharacter("Darabunga", [2, 2], 12, 12, [], 30,
                                      self.rangerSprite)
        self.tileList = []

        self.lblFPS = Label.Label()
        self.lblFPS.addText("FPS: " + str(round(Arcade._FPS)), Arcade.FONT,
                            (200, 200, 200), 50)

        self.tileObjectCreator(currentMap)
示例#21
0
    def __init__(self):

        #Main frame
        self.Main_frame = Frame.Frame(x=0, y=200, width=500, height=300)
        self.Main_frame.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.Main_frame.updateAttachedGuis(True)

        #subframe top
        self.Sub_frame_top = Frame.Frame(x=0, y=200, width=500, height=150)
        self.Sub_frame_top.alignVertically(self.Main_frame, Arcade.ALIGN_TOP)
        self.Sub_frame_top.alignHorizontally(self.Main_frame,
                                             Arcade.ALIGN_CENTER)
        self.Sub_frame_top.updateAttachedGuis(True)

        #subframe bottom
        self.Sub_frame_bottom = Frame.Frame(x=0, y=350, width=500, height=150)
        self.Sub_frame_bottom.alignVertically(self.Main_frame,
                                              Arcade.ALIGN_BOTTOM)
        self.Sub_frame_bottom.alignHorizontally(self.Main_frame,
                                                Arcade.ALIGN_CENTER)
        self.Sub_frame_bottom.updateAttachedGuis(True)

        #Main menu label
        self.Label = Label.Label(x=0, y=10)
        self.Label.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.Label.addText("GeoRush", Arcade.FONT, "white", 100)

        #Level 1 button
        self.B_LEVEL1 = Button.Button(x=0, y=30, width=120, height=60)
        self.B_LEVEL1.alignHorizontally(self.Sub_frame_top,
                                        Arcade.ALIGN_CENTER,
                                        offset=-150)
        self.B_LEVEL1.alignVertically(self.Sub_frame_top, Arcade.ALIGN_CENTER)
        self.B_LEVEL1.addText("Level 1", Arcade.FONT, "white", 20)

        #Level 2 button
        self.B_LEVEL2 = Button.Button(x=0, y=30, width=120, height=60)
        self.B_LEVEL2.alignHorizontally(self.Sub_frame_top,
                                        Arcade.ALIGN_CENTER)
        self.B_LEVEL2.alignVertically(self.Sub_frame_top, Arcade.ALIGN_CENTER)
        self.B_LEVEL2.addText("Level 2", Arcade.FONT, "white", 20)

        #Level 3 button
        self.B_LEVEL3 = Button.Button(x=0, y=30, width=120, height=60)
        self.B_LEVEL3.alignHorizontally(self.Sub_frame_top,
                                        Arcade.ALIGN_CENTER,
                                        offset=150)
        self.B_LEVEL3.alignVertically(self.Sub_frame_top, Arcade.ALIGN_CENTER)
        self.B_LEVEL3.addText("Level 3", Arcade.FONT, "white", 20)

        #Main menu button | Quit
        self.B_QUIT = Button.Button(x=0, y=30, width=120, height=60)
        self.B_QUIT.alignHorizontally(self.Sub_frame_bottom,
                                      Arcade.ALIGN_CENTER)
        self.B_QUIT.alignVertically(self.Sub_frame_bottom, Arcade.ALIGN_TOP)
        self.B_QUIT.addText("Quit", Arcade.FONT, "white", 20)

        self.Main_frame.attachGui(self.Sub_frame_top)
        self.Main_frame.attachGui(self.Sub_frame_bottom)

        self.Sub_frame_top.attachGui(self.B_LEVEL1)
        self.Sub_frame_top.attachGui(self.B_LEVEL2)
        self.Sub_frame_top.attachGui(self.B_LEVEL3)
        self.Sub_frame_bottom.attachGui(self.B_QUIT)
示例#22
0
    def __init__(self):
        super().__init__()

        self._width = 192

        self._frame = Frame.Frame(x=Arcade.SCREEN_WIDTH - self._width,
                                  y=0,
                                  width=self._width,
                                  height=Arcade.SCREEN_HEIGHT,
                                  bgColor=(206, 170, 130))
        self._frame.addBorder(2, (0, 0, 0))

        self._lblTitle = Label.Label(y=20)
        self._lblTitle.addText("Försvarare", Arcade.FONT, (255, 255, 255), 27)
        self._lblTitle.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)

        self._lblNoDefender = Label.Label(y=80)
        self._lblNoDefender.addText("Du har inga", Arcade.FONT,
                                    (255, 255, 255), 24)
        self._lblNoDefender.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)
        self._lblNoDefender2 = Label.Label(y=110)
        self._lblNoDefender2.addText("försvarare!", Arcade.FONT,
                                     (255, 255, 255), 24)
        self._lblNoDefender2.alignHorizontally(self._frame,
                                               Arcade.ALIGN_CENTER)

        self._btnSelect = Button.Button(y=80, width=150, height=50)
        self._btnSelect.addText("Välj", Arcade.FONT, (255, 255, 255), 30)
        self._btnSelect.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)
        self._btnSelect.addBorder(2, (0, 0, 0))

        self._btnMove = Button.Button(y=150, width=150, height=50)
        self._btnMove.addText("Flytta", Arcade.FONT, (255, 255, 255), 30)
        self._btnMove.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)
        self._btnMove.addBorder(2, (0, 0, 0))

        self._lblUpgrades = Label.Label(y=225)
        self._lblUpgrades.addText("Uppgraderingar", Arcade.FONT,
                                  (255, 255, 255), 20)
        self._lblUpgrades.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)

        self._upgradeButtons = []

        btn1 = UpgradeButton(y=280)
        btn1.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)
        self._upgradeButtons.append(btn1)

        btn2 = UpgradeButton(y=370)
        btn2.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)
        self._upgradeButtons.append(btn2)

        btn3 = UpgradeButton(y=460)
        btn3.alignHorizontally(self._frame, Arcade.ALIGN_CENTER)
        self._upgradeButtons.append(btn3)

        self._btnSelect.setNeighbors(None, self._btnMove, None, None)
        self._btnMove.setNeighbors(self._btnSelect, btn1, None, None)
        btn1.setNeighbors(self._btnMove, btn2, None, None)
        btn2.setNeighbors(btn1, btn3, None, None)
        btn3.setNeighbors(btn2, None, None, None)

        self._selectedDefender = None
示例#23
0
    def onPlay(self):
        super().onPlay()

        self.screen = Arcade.screen
        self.timer = Timer.Timer(1)
        self.timer.start()

        self.tileSize = 40  # Size of each tile
        self.gameLevel = [  # 0 = Wall, 1 = Smallball, 2 = Bigball
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0],
            [0, 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 0],
            [0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0],
            [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0],
            [0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0],
            [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0],  # Halfway
            [0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0],
            [0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0],
            [0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0],
            [0, 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 0],
            [0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0],
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        ]  # Total size is 13x13

        self.pos = [6, 11]
        self.dir = "none"
        self.nextMove = "none"

        self.xOffset = 0
        self.yOffset = 0

        self.DisplayXOffset = Arcade.SCREEN_WIDTH / 2 - (
            self.tileSize * len(self.gameLevel[1])) / 2
        self.DisplayYOffset = Arcade.SCREEN_HEIGHT / 2 - (
            self.tileSize * len(self.gameLevel)) / 2

        self.movementSpeed = 3

        entitySpriteSheet = SpriteSheet.SpriteSheet(
            "games/Pacman/img/entites2.png", 16)
        entitySpriteSheet.scaleImages(32)
        self.AnimPlayerUp = Animation.Animation(
            entitySpriteSheet.getImagesByRow(2, 2), 400, continuous=True)
        self.AnimPlayerUp.start()
        self.AnimPlayerRight = Animation.Animation(
            entitySpriteSheet.getImagesByRow(0, 2), 400, continuous=True)
        self.AnimPlayerRight.start()
        self.AnimPlayerDown = Animation.Animation(
            entitySpriteSheet.getImagesByRow(3, 2), 400, continuous=True)
        self.AnimPlayerDown.start()
        self.AnimPlayerLeft = Animation.Animation(
            entitySpriteSheet.getImagesByRow(1, 2), 400, continuous=True)
        self.AnimPlayerLeft.start()

        self.CurrentAnim = self.AnimPlayerUp

        self.currentScore = 0
        self.ScoreText = Label.Label(x=10, y=10)
        self.ScoreText.addText("Score", Arcade.FONT, "yellow", 32)
        self.WonText = Label.Label()
        self.WonText.addText("You won!", Arcade.FONT, "yellow", 128)
        self.WonText.alignVertically(None, Arcade.ALIGN_CENTER)
        self.WonText.alignHorizontally(None, Arcade.ALIGN_CENTER)
        self.WonUnderText = Label.Label()
        self.WonUnderText.addText('Press "Button 1" to play again!',
                                  Arcade.FONT, "yellow", 32)
        self.WonUnderText.alignVertically(None, Arcade.ALIGN_CENTER, 80)
        self.WonUnderText.alignHorizontally(None, Arcade.ALIGN_CENTER)