示例#1
0
    def __init__(self, player, master, controller, x=0, y=0):

        self.player = player
        self.master = master
        self.controller = controller

        self.active_bean_stat = 0

        self.x = x
        self.y = y

        self.id = "health_display"

        self.background = gui_components.Fill(self.x, self.y, 200, 209, constants.GUI_BACKING)

        self.bean_stats = [gui_components.Fill(self.x+5, self.y+5+35*n, 190, 30, constants.GUI_FILL)
                           for n in range(len(self.player.beans))]
        self.health_bars = [gui_components.ProgressBar(self.x+9, self.y+27+36*n, 182, 5,
                                                       (constants.HEALTH_BAR_RED, constants.HEALTH_BAR_GREEN))
                            for n in range(len(self.player.beans))]
        self.bean_labels = [gui_components.Label(self.x+9, self.y+3+40*n, "{}{} Bean".format(
            self.player.beans[n].bean[0].upper(), self.player.beans[n].bean[1:]),
                                                 False, 20, constants.BLACK)
                            for n in range(len(self.player.beans))]

        self.xp_bar = gui_components.ProgressBar(self.x+9, self.y+37+34*self.active_bean_stat, 182, 5,
                                                 (constants.XP_BAR_BLUE, constants.XP_BAR_CYAN))

        self.level_label = gui_components.Label(self.x, self.y+41+35*self.active_bean_stat, "Level {}".format(
            self.player.beans[self.active_bean_stat].meta.level), False, 20, constants.BLACK)

        self.components = [self.background] + self.bean_stats + self.health_bars + self.bean_labels +\
                          [self.xp_bar, self.level_label]
示例#2
0
    def __init__(self, entity, x, y):

        self.x = x
        self.y = y

        self.id = "enemy_stats"

        self.enemy_meta = entity.meta

        self.background = gui_components.Fill(self.x, self.y, 190, 60,
                                              constants.GUI_FILL)

        self.health_bar = gui_components.ProgressBar(
            self.x + 4, self.y + 24, 182, 5,
            (constants.HEALTH_BAR_RED, constants.HEALTH_BAR_GREEN))
        self.xp_bar = gui_components.ProgressBar(
            self.x + 4, self.y + 32, 182, 5,
            (constants.XP_BAR_BLUE, constants.XP_BAR_CYAN))
        self.bean_name = gui_components.Label(self.x + 4, self.y - 2,
                                              self.enemy_meta.display_name,
                                              False, 20, constants.BLACK)
        self.bean_level = gui_components.Label(
            self.x + 152, self.y + 36,
            "Level {}".format(self.enemy_meta.level), False, 20,
            constants.BLACK)
        self.bean_level.rect.topright = [self.x + 188, self.y + 36]

        self.components = [
            self.background, self.health_bar, self.xp_bar, self.bean_name,
            self.bean_level
        ]

        self.on = True
示例#3
0
    def __init__(self, player, master, controller, x, y):

        self.player = player
        self.master = master
        self.controller = controller

        self.active_bean_stat = 0

        self.x = x
        self.y = y

        self.id = "health_display"

        self.bean_stats = [
            gui_components.Fill(self.x + 5, self.y + 5 + 35 * n, 190, 30,
                                constants.GUI_FILL)
            for n in range(len(self.player.beans))
        ]
        self.health_bars = [
            gui_components.ProgressBar(
                self.x + 9, self.y + 27 + 36 * n, 182, 5,
                (constants.HEALTH_BAR_RED, constants.HEALTH_BAR_GREEN))
            for n in range(len(self.player.beans))
        ]
        self.bean_labels = [
            gui_components.Label(self.x + 9, self.y + 3 + 40 * n,
                                 self.player.beans[n].meta.display_name, False,
                                 20, constants.BLACK)
            for n in range(len(self.player.beans))
        ]

        self.xp_bar = gui_components.ProgressBar(
            self.x + 9, self.y + 37 + 34 * self.active_bean_stat, 182, 5,
            (constants.XP_BAR_BLUE, constants.XP_BAR_CYAN))

        self.level_label = gui_components.Label(
            self.x, self.y + 41 + 35 * self.active_bean_stat,
            "Level {}".format(
                self.player.beans[self.active_bean_stat].meta.level), False,
            20, constants.BLACK)

        self.components = self.bean_stats + self.health_bars + self.bean_labels + [
            self.xp_bar, self.level_label
        ]

        self.update_required = True
示例#4
0
    def __init__(self, master):

        self.master = master

        self.brain = brain.Brain(12, 4)
        self.particle_engine = self.master.particle_engine

        self.images = load_images()

        self.background = self.images["background"]

        self.attack_main_button = gui_components.Button(
            self.images["attack_main_button"], 508, 584,
            lambda: self.callback(0))
        self.attack_alt_button = gui_components.Button(
            self.images["attack_alt_button"], 730, 584,
            lambda: self.callback(1))
        self.item_button = gui_components.Button(self.images["item_button"],
                                                 508, 645,
                                                 lambda: self.callback(2))
        self.retreat_button = gui_components.Button(
            self.images["retreat_button"], 730, 645, lambda: self.callback(3))

        self.buttons = [
            self.attack_main_button, self.attack_alt_button, self.item_button,
            self.retreat_button
        ]

        self.player = None
        self.enemy = None

        self.player_hp_bar = gui_components.ProgressBar(
            563, 379, 282, 30,
            [constants.HEALTH_BAR_RED, constants.HEALTH_BAR_GREEN])
        self.enemy_hp_bar = gui_components.ProgressBar(
            81, 38, 282, 30,
            [constants.HEALTH_BAR_RED, constants.HEALTH_BAR_GREEN])

        self.player_xp_bar = gui_components.ProgressBar(
            563, 519, 282, 30, [constants.XP_BAR_BLUE, constants.XP_BAR_CYAN])
        self.enemy_xp_bar = gui_components.ProgressBar(
            81, 108, 282, 30, [constants.XP_BAR_BLUE, constants.XP_BAR_CYAN])

        self.player_energy_bar = gui_components.ProgressBar(
            563, 449, 282, 30,
            [constants.ENERGY_BAR_ORANGE, constants.ENERGY_BAR_YELLOW])

        self.progress_bars = [
            self.player_hp_bar, self.enemy_hp_bar, self.player_xp_bar,
            self.enemy_xp_bar, self.player_energy_bar
        ]

        self.player_hp_label = gui_components.Label(857, 359, "")
        self.enemy_hp_label = gui_components.Label(373, 18, "")

        self.player_xp_label = gui_components.Label(857, 500, "")
        self.enemy_xp_label = gui_components.Label(373, 89, "")
        self.player_energy_label = gui_components.Label(857, 429, "")

        self.player_level_label = gui_components.Label(649, 499, "")
        self.enemy_level_label = gui_components.Label(160, 88, "")

        self.attack_main_label = None
        self.attack_alt_label = None

        self.player_name_label = None
        self.enemy_name_label = None

        self.winner_label = None

        self.text = [
            self.player_hp_label, self.enemy_hp_label, self.player_xp_label,
            self.enemy_xp_label, self.player_energy_label,
            self.player_level_label, self.enemy_level_label
        ]

        self.turn = 0
        self.turn_cool_down = 50

        self.game_won = False
        self.game_won_counter = 0
        self.winner = ""
        self.shown_win = False