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.
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/PKG-INFO +2 -2
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/pyproject.toml +2 -2
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/game.py +7 -2
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero_plus.egg-info/PKG-INFO +2 -2
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_game_state.py +25 -6
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/COPYING +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/README.md +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/setup.cfg +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/__init__.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/__main__.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/actor.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/animation.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/builtins.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/clock.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/constants.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/data/icon.png +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/data/joypad.png +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/keyboard.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/loaders.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/music.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/ptext.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/rect.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/runner.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/screen.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/soundfmt.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/spellcheck.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/sprites.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/storage.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/tilemaps.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero/tone.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero_plus.egg-info/SOURCES.txt +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero_plus.egg-info/dependency_links.txt +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero_plus.egg-info/entry_points.txt +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero_plus.egg-info/requires.txt +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzero_plus.egg-info/top_level.txt +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/src/pgzrun.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_actor.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_actor_features.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_animation.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_builtins.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_event_dispatch.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_keyboard.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_music.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_rect_actor.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_runner.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_screen.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_sound_formats.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_spellcheck.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_sprites.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_storage.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_tilemaps.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_tone.py +0 -0
- {pgzero_plus-0.1.0a2 → pgzero_plus-0.1.0a3}/test/test_transform_anchor.py +0 -0
- {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.
|
|
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://
|
|
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.
|
|
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://
|
|
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
|
-
"""
|
|
128
|
-
|
|
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.
|
|
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://
|
|
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
|
|
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
|
|
136
|
+
def test_can_end_again_after_restart(self):
|
|
119
137
|
g = Game()
|
|
120
|
-
g.
|
|
121
|
-
g.
|
|
122
|
-
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|