Example #1
0
 def __init__(self):
     super().__init__()
     self.background = BLACK
     self.new_game = Button("New Game", MEDIUM_FONT, WHITE, LIGHTBLUE)
     self.quit = Button("Quit", MEDIUM_FONT, WHITE, RED)
     self.next = "SPLASH"
     self.alpha = 0
     self.rate = 5
     self.background = pg.Surface(SCREEN_RECT.size)
     self.background.fill(BLACK)
Example #2
0
    def generate_buttons(self):
        #Generating all the buttons
        self.buttons = []

        self.play_button = Button({'x':width//2, 'y':height//2+200, 'w':130, 'h':50}, {'color':white, 'hover_color':green, 'font_color':black, 'alpha':128}, {'text':'Play', 'font':'comicsans', 'font_size':30})
        self.upgrade_button = Button({'x':width//2-150, 'y':height//2+200, 'w':130, 'h':50}, {'color':white, 'hover_color':green, 'font_color':black, 'alpha':128}, {'text':'Upgrade', 'font':'comicsans', 'font_size':30})
        self.howtoplay_button = Button({'x':width//2+150, 'y':height//2+200, 'w':130, 'h':50}, {'color':white, 'hover_color':green, 'font_color':black, 'alpha':128}, {'text':'How to play', 'font':'comicsans', 'font_size':30})

        self.buttons.append(self.play_button)
        self.buttons.append(self.upgrade_button)
        self.buttons.append(self.howtoplay_button)
Example #3
0
 def generate_buttons(self):
     #The close button
     self.button = Button(
         {
             'x': width // 2,
             'y': height // 2 + 250,
             'w': 100,
             'h': 50
         }, {
             'color': white,
             'hover_color': green,
             'font_color': black,
             'alpha': 128
         }, {
             'text': 'Back',
             'font': 'comicsans',
             'font_size': 30
         })
Example #4
0
 def __init__(self):
     #Setting up play button
     self.game_button = Button(
         {
             'x': width // 2,
             'y': height // 2 + 100,
             'w': 130,
             'h': 50
         }, {
             'color': white,
             'hover_color': green,
             'font_color': black,
             'alpha': 128
         }, {
             'text': 'Play',
             'font': 'comicsans',
             'font_size': 30
         })
     self.game = Game()
     self.image = pygame.image.load('data/image/title.png')
     self.font = pygame.font.SysFont('comcisans', 25)
Example #5
0
    def generate_buttons(self):
        #Generating all the buttons
        self.buttons = []

        self.timer_button = Button(
            {
                'x': width // 2,
                'y': height // 2 + 200,
                'w': 150,
                'h': 50
            }, {
                'color': white,
                'hover_color': green,
                'font_color': black,
                'alpha': 128
            }, {
                'text': f'Timer({costs["timer"]})',
                'font': 'comicsans',
                'font_size': 30
            })
        self.health_button = Button(
            {
                'x': width // 2 - 180,
                'y': height // 2 + 200,
                'w': 150,
                'h': 50
            }, {
                'color': white,
                'hover_color': green,
                'font_color': black,
                'alpha': 128
            }, {
                'text': f'Health({costs["health"]})',
                'font': 'comicsans',
                'font_size': 30
            })
        self.damage_button = Button(
            {
                'x': width // 2 + 180,
                'y': height // 2 + 200,
                'w': 150,
                'h': 50
            }, {
                'color': white,
                'hover_color': green,
                'font_color': black,
                'alpha': 128
            }, {
                'text': f'Damage({costs["damage_amount"]})',
                'font': 'comicsans',
                'font_size': 30
            })
        self.close_button = Button(
            {
                'x': width // 2,
                'y': height // 2 + 270,
                'w': 150,
                'h': 50
            }, {
                'color': white,
                'hover_color': green,
                'font_color': black,
                'alpha': 128
            }, {
                'text': 'Back',
                'font': 'comicsans',
                'font_size': 30
            })

        self.buttons.append(self.timer_button)
        self.buttons.append(self.health_button)
        self.buttons.append(self.damage_button)
        self.buttons.append(self.close_button)
Example #6
0
 def __init__(self):
     self.player = Player(width//2, height-300)
     self.close_button = Button({'x':60, 'y':30, 'w':100, 'h':50}, {'color':white, 'hover_color':green, 'font_color':black, 'alpha':128}, {'text':'Close', 'font':'comicsans', 'font_size':30})