Skip to content

Commit

Permalink
Scenario and controller names can be shown in the environment graphics
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonmkunkel committed Apr 9, 2021
1 parent 4b9cbc1 commit a1d78be
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [1.2.2] - 9 April 2021

- Scenario and controller names can now be shown in the environment graphics

## [1.2.1] - 8 April 2021

- Default accuracy value changed to 0% not 100%
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ and simply use

pip install -r requirements.txt

We recommend tracking your proejct dependencies
We recommend tracking your project dependencies

## Upgrading

Expand Down
2 changes: 1 addition & 1 deletion src/fuzzy_asteroids/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.2.1"
__version__ = "1.2.2"
2 changes: 1 addition & 1 deletion src/fuzzy_asteroids/fuzzy_asteroids.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def timer_interface(self):
try:
yield

except BaseException:
except BaseException as e:
self.score.exceptions += 1

finally:
Expand Down
12 changes: 8 additions & 4 deletions src/fuzzy_asteroids/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ def start_new_game(self, scenario: Scenario = None, score: Score = None, **kwarg
# Get the asteroids from the Scenario (which builds them based on the Scenario settings)
self.asteroid_list.extend(self.scenario.asteroids(self.frequency))

# Update the window title
if self.scenario.name:
self.set_caption(f"{SCREEN_TITLE} - Scenario: {self.scenario.name}")

# This will resize the window if the dimensions are different from global
# This behavior is not tested well
if self.scenario.game_map.default_dimensions != (SCREEN_WIDTH, SCREEN_HEIGHT):
Expand All @@ -199,6 +195,14 @@ def on_draw(self) -> None:
self.player_sprite_list.draw()
self.text_sprite_list.draw()

if self.scenario.name:
output = f"Scenario: {self.scenario.name}"
arcade.draw_text(output, 10, SCREEN_HEIGHT - 25, self.color_text, 13)

if self.controller_name:
output = f"Controller: {self.controller_name}"
arcade.draw_text(output, 10, SCREEN_HEIGHT - 45, self.color_text, 13)

# Put the text on the screen.
output = f"Time Limit: {self.time_limit if not self.time_limit == float('inf') else None}"
arcade.draw_text(output, 10, 110, self.color_text, 13)
Expand Down

0 comments on commit a1d78be

Please sign in to comment.