pgzero-plus 0.1.0a2__tar.gz → 0.1.0a3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/PKG-INFO +2 -2
  2. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/pyproject.toml +2 -2
  3. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/game.py +7 -2
  4. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero_plus.egg-info/PKG-INFO +2 -2
  5. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_game_state.py +25 -6
  6. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/COPYING +0 -0
  7. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/README.md +0 -0
  8. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/setup.cfg +0 -0
  9. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/__init__.py +0 -0
  10. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/__main__.py +0 -0
  11. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/actor.py +0 -0
  12. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/animation.py +0 -0
  13. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/builtins.py +0 -0
  14. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/clock.py +0 -0
  15. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/constants.py +0 -0
  16. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/data/icon.png +0 -0
  17. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/data/joypad.png +0 -0
  18. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/keyboard.py +0 -0
  19. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/loaders.py +0 -0
  20. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/music.py +0 -0
  21. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/ptext.py +0 -0
  22. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/rect.py +0 -0
  23. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/runner.py +0 -0
  24. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/screen.py +0 -0
  25. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/soundfmt.py +0 -0
  26. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/spellcheck.py +0 -0
  27. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/sprites.py +0 -0
  28. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/storage.py +0 -0
  29. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/tilemaps.py +0 -0
  30. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/tone.py +0 -0
  31. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero_plus.egg-info/SOURCES.txt +0 -0
  32. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero_plus.egg-info/dependency_links.txt +0 -0
  33. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero_plus.egg-info/entry_points.txt +0 -0
  34. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero_plus.egg-info/requires.txt +0 -0
  35. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero_plus.egg-info/top_level.txt +0 -0
  36. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzrun.py +0 -0
  37. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_actor.py +0 -0
  38. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_actor_features.py +0 -0
  39. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_animation.py +0 -0
  40. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_builtins.py +0 -0
  41. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_event_dispatch.py +0 -0
  42. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_keyboard.py +0 -0
  43. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_music.py +0 -0
  44. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_rect_actor.py +0 -0
  45. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_runner.py +0 -0
  46. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_screen.py +0 -0
  47. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_sound_formats.py +0 -0
  48. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_spellcheck.py +0 -0
  49. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_sprites.py +0 -0
  50. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_storage.py +0 -0
  51. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_tilemaps.py +0 -0
  52. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_tone.py +0 -0
  53. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_transform_anchor.py +0 -0
  54. {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_webp_loader.py +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pgzero-plus
3
- Version: 0.1.0a2
3
+ Version: 0.1.0a3
4
4
  Summary: An enhanced fork of Pygame Zero with additional features for teaching and developing 2D games
5
5
  Author-email: Michael D'Argenio <mjdargen@gmail.com>
6
6
  License-Expression: LGPL-3.0-or-later
7
7
  Project-URL: Homepage, https://github.com/mjdargen/pgzero
8
- Project-URL: Documentation, https://pygame-zero.readthedocs.io/
8
+ Project-URL: Documentation, https://pgzero-plus.readthedocs.io/
9
9
  Project-URL: Source, https://github.com/mjdargen/pgzero
10
10
  Project-URL: Issues, https://github.com/mjdargen/pgzero/issues
11
11
  Keywords: pygame,pgzero,games,education
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pgzero-plus"
3
- version = "0.1.0a2"
3
+ version = "0.1.0a3"
4
4
  description = "An enhanced fork of Pygame Zero with additional features for teaching and developing 2D games"
5
5
  readme = "README.md"
6
6
  license = "LGPL-3.0-or-later"
@@ -27,7 +27,7 @@ classifiers = [
27
27
 
28
28
  [project.urls]
29
29
  Homepage = "https://github.com/mjdargen/pgzero"
30
- Documentation = "https://pygame-zero.readthedocs.io/"
30
+ Documentation = "https://pgzero-plus.readthedocs.io/"
31
31
  Source = "https://github.com/mjdargen/pgzero"
32
32
  Issues = "https://github.com/mjdargen/pgzero/issues"
33
33
 
@@ -22,6 +22,7 @@ DISPLAY_FLAGS = pygame.SHOWN
22
22
 
23
23
 
24
24
  class Game:
25
+ ENDED_STATES = ("won", "lost", "over")
25
26
  """
26
27
  Simple game-wide state container for beginner projects.
27
28
 
@@ -124,8 +125,12 @@ class Game:
124
125
  self._is_restarting = False
125
126
 
126
127
  def _end(self, state, restart_after, clear_clock):
127
- """Leave the "playing" state, optionally scheduling a restart."""
128
- if self.state != "playing":
128
+ """End the game, optionally scheduling a restart.
129
+
130
+ Does nothing if the game has already ended, so it is safe to call
131
+ every frame (e.g. from update()).
132
+ """
133
+ if self.state in self.ENDED_STATES:
129
134
  return
130
135
  self._check_can_delay(restart_after)
131
136
  self.state = state
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pgzero-plus
3
- Version: 0.1.0a2
3
+ Version: 0.1.0a3
4
4
  Summary: An enhanced fork of Pygame Zero with additional features for teaching and developing 2D games
5
5
  Author-email: Michael D'Argenio <mjdargen@gmail.com>
6
6
  License-Expression: LGPL-3.0-or-later
7
7
  Project-URL: Homepage, https://github.com/mjdargen/pgzero
8
- Project-URL: Documentation, https://pygame-zero.readthedocs.io/
8
+ Project-URL: Documentation, https://pgzero-plus.readthedocs.io/
9
9
  Project-URL: Source, https://github.com/mjdargen/pgzero
10
10
  Project-URL: Issues, https://github.com/mjdargen/pgzero/issues
11
11
  Keywords: pygame,pgzero,games,education
@@ -108,18 +108,37 @@ class GameStateTransitionTest(unittest.TestCase):
108
108
  getattr(g, method)()
109
109
  self.assertEqual(g.state, state)
110
110
 
111
- def test_end_only_from_playing(self):
111
+ def test_cannot_end_twice(self):
112
112
  """Once the game has ended, a second win/lose call is ignored."""
113
+ for first, second in [("lose", "win"), ("win", "over"),
114
+ ("over", "lose")]:
115
+ with self.subTest(first=first, second=second):
116
+ g = Game()
117
+ getattr(g, first)()
118
+ ended = g.state
119
+ getattr(g, second)()
120
+ self.assertEqual(g.state, ended)
121
+
122
+ def test_can_end_while_paused(self):
123
+ """e.g. choosing "quit" from a pause menu."""
113
124
  g = Game()
125
+ g.pause()
126
+ g.over()
127
+ self.assertEqual(g.state, "over")
128
+
129
+ def test_can_end_from_custom_state(self):
130
+ """e.g. a "dying" state that plays an animation before losing."""
131
+ g = Game()
132
+ g.state = "dying"
114
133
  g.lose()
115
- g.win()
116
134
  self.assertEqual(g.state, "lost")
117
135
 
118
- def test_cannot_end_while_paused(self):
136
+ def test_can_end_again_after_restart(self):
119
137
  g = Game()
120
- g.pause()
121
- g.over()
122
- self.assertEqual(g.state, "paused")
138
+ g.lose()
139
+ g.restart()
140
+ g.win()
141
+ self.assertEqual(g.state, "won")
123
142
 
124
143
 
125
144
  class GameTickTest(unittest.TestCase):
File without changes
File without changes
File without changes