def render_ui_box( console: Console, engine: Engine, ) -> None: console.draw_rect(x=1, y=44, width=98, height=5, ch=1, bg=color.ui_box_bg) console.draw_frame(1, 44, 98, 5, "", True, color.ui_box_fg, color.ui_box_bg) console.draw_rect(x=22, y=45, width=1, height=3, ch=9474, fg=color.ui_box_fg) console.print(x=2, y=45, string=engine.player.name, fg=color.ui_box_fg)
def render_bar(console: Console, current_value: int, maximum_value: int, total_width: int) -> None: bar_x = 1 bar_y = 45 bar_height = 1 text_x = 5 bar_width = int(float(current_value) / maximum_value * total_width) console.draw_rect(x=bar_x, y=bar_y, width=20, height=bar_height, ch=1, bg=color.bar_empty) if bar_width > 0: console.draw_rect(x=bar_x, y=bar_y, width=bar_width, height=bar_height, ch=1, bg=color.bar_filled) console.print(x=text_x, y=bar_y, string=f"HP: {current_value}/{maximum_value}", fg=color.bar_text)
def render_bar(console: Console, character: Actor, current_value: int, maximum_value: int, total_width: int) -> None: bar_width = int(float(current_value) / maximum_value * total_width) console.draw_rect(x=1, y=44, width=20, height=1, ch=1, bg=(191, 0, 0)) if bar_width > 0: console.draw_rect(x=1, y=44, width=bar_width, height=1, ch=1, bg=(0, 191, 0)) console.print( x=1, y=45, string=f'HP: {current_value}/{maximum_value}') render_stats(console, character)
def render_bar( console: Console, current_value: int, maximum_value: int, total_width: int ) -> None: bar_width = int(float(current_value) / maximum_value * total_width) console.draw_rect(x=2, y=46, width=20, height=1, ch=1, bg=color.hp_bar_empty) if bar_width > 0: console.draw_rect( x=2, y=46, width=bar_width, height=1, ch=1, bg=color.hp_bar_filled ) console.print( x=3, y=46, string=f"HP: {current_value}/{maximum_value}", fg=color.ui_box_bg )
def render_bar( console: Console, current_value: int, maximum_value: int, total_width: int, ) -> None: """Utilizes the tcod draw_rect functions to draw two rectangular bars and overlays it with text.""" bar_width = int( float( current_value ) / maximum_value * total_width ) # I wonder if there's anything I could create and throw in here instead of so many arguments? console.draw_rect( x = 0, y = 45, width = 20, height = 1, ch = 1, bg = color.bar_empty ) if bar_width > 0: console.draw_rect( x = 0, y = 45, width = bar_width, height = 1, ch = 1, bg = color.bar_filled ) console.print( x = 1, y = 45, string = f"HP: {current_value}/{maximum_value}", fg = color.bar_text )
def render_bar( console: Console, current_value: int, maximum_value: int, total_width: int ) -> None: """Appearance of the health bar""" bar_width = int(float(current_value) / maximum_value * total_width) console.draw_rect(x=0, y=45, width=20, height=1, ch=1, bg=color.bar_empty) if bar_width > 0: console.draw_rect( x=0, y=45, width=bar_width, height=1, ch=1, bg=color.bar_filled ) console.print( x=1, y=45, string=f"HP: {current_value}/{maximum_value}", fg=color.bar_text )
def render_mana_bar(console: Console, current_value: int, maximum_value: int, total_width: int) -> None: bar_width = int(float(current_value) / maximum_value * total_width) console.draw_rect(x=60, y=45, width=20, height=1, ch=1, bg=color.bar_empty) if bar_width > 0: console.draw_rect(x=60, y=45, width=bar_width, height=1, ch=1, bg=color.bar_filled_blue) console.print(x=61, y=45, string=f"Mana: {current_value}/{maximum_value}", fg=color.bar_text)
def render_bar(console: Console, current_value, maximum_value, total_width) -> None: bar_width = int(float(current_value) / maximum_value * total_width) console.draw_rect(x=0, y=45, width=20, height=1, ch=1, bg=color.bar_empty) if bar_width > 0: console.draw_rect(x=0, y=45, width=bar_width, height=1, ch=1, bg=color.bar_filled) console.print( x=1, y=45, string= f"HP: {int(current_value / maximum_value * 100)}% ({current_value}/{maximum_value})", fg=color.bar_text)
def render_bar( #шкала здоровья console: Console, current_value: int, maximum_value: int, total_width: int) -> None: bar_width = int(float(current_value) / maximum_value * total_width) console.draw_rect(x=0, y=47, width=20, height=1, ch=1, bg=color.bar_empty) #рисует красную полосу if bar_width > 0: console.draw_rect( x=0, y=47, width=bar_width, height=1, ch=1, bg=color.bar_filled #рисует зеленую поверх красной ) console.print(x=1, y=47, string=f"HP: {current_value}/{maximum_value}", fg=color.bar_text)
def render_foodbar(console: Console, current_value: int, maximum_value: int, total_width: int) -> None: bar_width = int(float(current_value) / maximum_value * total_width) console.draw_rect(x=0, y=46, width=20, height=1, ch=1, bg=color.food_bar_empty) if bar_width > 0: console.draw_rect(x=0, y=46, width=bar_width, height=1, ch=1, bg=color.food_bar_filled) console.print(x=1, y=46, string=f"STOMACH: {current_value}/{maximum_value}", fg=color.bar_text)
def render_health_bar(console: Console, x: int, y: int, current_value: int, maximum_value: int, total_width: int) -> None: bar_width = int(float(current_value) / maximum_value * total_width) console.draw_rect(x=x, y=y, width=total_width, height=1, ch=1, bg=color.health_bar_empty) if bar_width > 0: console.draw_rect(x=x, y=y, width=bar_width, height=1, ch=1, bg=color.health_bar_filled) console.print(x=x, y=y, string=f"HP: {current_value}/{maximum_value}", fg=color.white)
def render_bar(console: Console, current_value: int, maximum_value: int, total_width: int) -> None: bar_width = int(total_width * float(current_value) / maximum_value) console.draw_rect(x=0, y=45, width=total_width, height=1, ch=1, bg=color.BAR_EMPTY) if bar_width > 0: console.draw_rect(x=0, y=45, width=bar_width, height=1, ch=1, bg=color.BAR_FILLED) console.print(x=1, y=45, string=f"HP: {current_value}/{maximum_value}", fg=color.BAR_TEXT)