Skip to content

Commit

Permalink
test-driven refactoring of window setup
Browse files Browse the repository at this point in the history
  • Loading branch information
filiplajszczak committed Feb 29, 2020
1 parent 4fd60b9 commit cb330d0
Showing 1 changed file with 9 additions and 28 deletions.
37 changes: 9 additions & 28 deletions source/game_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,34 +56,15 @@ def setup(self):

self.game_engine.setup()

spacing = 37
y_value = SCREEN_HEIGHT - 75
sprite = arcade.Sprite("images/plus_button.png")
sprite.center_x = 200
sprite.center_y = y_value
sprite.name = "attack"
self.character_sheet_buttons.append(sprite)

y_value -= spacing
sprite = arcade.Sprite("images/plus_button.png")
sprite.center_x = 200
sprite.center_y = y_value
sprite.name = "defense"
self.character_sheet_buttons.append(sprite)

y_value -= spacing
sprite = arcade.Sprite("images/plus_button.png")
sprite.center_x = 200
sprite.center_y = y_value
sprite.name = "hp"
self.character_sheet_buttons.append(sprite)

y_value -= spacing
sprite = arcade.Sprite("images/plus_button.png")
sprite.center_x = 200
sprite.center_y = y_value
sprite.name = "capacity"
self.character_sheet_buttons.append(sprite)
for button_name, y_value in zip(
["attack", "defense", "hp", "capacity"],
range(SCREEN_HEIGHT - 75, 490, -37)
):
sprite = arcade.Sprite("images/plus_button.png")
sprite.center_x = 200
sprite.center_y = y_value
sprite.name = button_name
self.character_sheet_buttons.append(sprite)

def draw_hp_and_status_bar(self):
text = f"HP: {self.game_engine.player.fighter.hp}/{self.game_engine.player.fighter.max_hp}"
Expand Down

0 comments on commit cb330d0

Please sign in to comment.