ed-game 4.0.0.dev2__tar.gz → 5.0.0rc2__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.
- ed_game-5.0.0rc2/MANIFEST.in +2 -0
- ed_game-5.0.0rc2/PKG-INFO +56 -0
- ed_game-5.0.0rc2/README.md +34 -0
- {ed_game-4.0.0.dev2 → ed_game-5.0.0rc2}/edgame_core.cpp +3 -3
- {ed_game-4.0.0.dev2 → ed_game-5.0.0rc2}/pyproject.toml +2 -5
- {ed_game-4.0.0.dev2 → ed_game-5.0.0rc2}/src/ed_game/__init__.py +1 -1
- {ed_game-4.0.0.dev2 → ed_game-5.0.0rc2}/src/ed_game/game_2.py +2 -6
- ed_game-5.0.0rc2/src/ed_game.egg-info/PKG-INFO +56 -0
- {ed_game-4.0.0.dev2 → ed_game-5.0.0rc2}/src/ed_game.egg-info/SOURCES.txt +1 -3
- {ed_game-4.0.0.dev2 → ed_game-5.0.0rc2}/src/ed_game.egg-info/requires.txt +0 -1
- ed_game-4.0.0.dev2/MANIFEST.in +0 -1
- ed_game-4.0.0.dev2/PKG-INFO +0 -70
- ed_game-4.0.0.dev2/README.md +0 -47
- ed_game-4.0.0.dev2/src/ed_game/new/__init__.py +0 -1
- ed_game-4.0.0.dev2/src/ed_game/new/game.py +0 -186
- ed_game-4.0.0.dev2/src/ed_game.egg-info/PKG-INFO +0 -70
- {ed_game-4.0.0.dev2 → ed_game-5.0.0rc2}/LICENSE +0 -0
- {ed_game-4.0.0.dev2 → ed_game-5.0.0rc2}/setup.cfg +0 -0
- {ed_game-4.0.0.dev2 → ed_game-5.0.0rc2}/src/ed_game/game_1.py +0 -0
- {ed_game-4.0.0.dev2 → ed_game-5.0.0rc2}/src/ed_game.egg-info/dependency_links.txt +0 -0
- {ed_game-4.0.0.dev2 → ed_game-5.0.0rc2}/src/ed_game.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ed-game
|
|
3
|
+
Version: 5.0.0rc2
|
|
4
|
+
Summary: Earth Defense Game
|
|
5
|
+
Author-email: qq-name <your@email.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://pypi.org/project/ed-game/
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.16
|
|
13
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Topic :: Games/Entertainment
|
|
17
|
+
Requires-Python: >=3.13
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: pygame-ce>=2.5.3
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
Installing:
|
|
24
|
+
|
|
25
|
+
pip install ed-game
|
|
26
|
+
|
|
27
|
+
or:
|
|
28
|
+
|
|
29
|
+
pip3 install ed-game
|
|
30
|
+
|
|
31
|
+
Usage:
|
|
32
|
+
|
|
33
|
+
import ed_game
|
|
34
|
+
ed_game.run()
|
|
35
|
+
|
|
36
|
+
ed-game dependencies:
|
|
37
|
+
1. setuptools>=77.3.4 (build dependency)
|
|
38
|
+
2. pygame-ce >= 2.5.3 (core of ed-game)
|
|
39
|
+
3. CPython >= 3.13
|
|
40
|
+
|
|
41
|
+
## Version Support
|
|
42
|
+
|
|
43
|
+
| Series | Status | Note |
|
|
44
|
+
|--------|--------|------|
|
|
45
|
+
| **5.x** | ✅ **Recommended** | Active development, new features |
|
|
46
|
+
| 4.x | ❌ Discontinued | Unresolved low-level OpenGL error in module `a1`; cannot be fixed |
|
|
47
|
+
| 3.x | 🛠 Maintenance | Critical bug fixes only |
|
|
48
|
+
| 2.x | 🛠 Maintenance | Critical bug fixes only |
|
|
49
|
+
|
|
50
|
+
> **Notice:** The 4.x line has reached end-of-life due to an unfixable OpenGL defect in `a1`. Please use **5.x** for new projects; 3.x remains available for legacy users who cannot upgrade.
|
|
51
|
+
|
|
52
|
+
## About
|
|
53
|
+
|
|
54
|
+
**Earth Defense Game** — a cross-platform shooter.
|
|
55
|
+
- **Windows:** accelerated via a compiled C++ extension.
|
|
56
|
+
- **Other platforms:** runs on a 100% pure-Python fallback.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Installing:
|
|
2
|
+
|
|
3
|
+
pip install ed-game
|
|
4
|
+
|
|
5
|
+
or:
|
|
6
|
+
|
|
7
|
+
pip3 install ed-game
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
|
|
11
|
+
import ed_game
|
|
12
|
+
ed_game.run()
|
|
13
|
+
|
|
14
|
+
ed-game dependencies:
|
|
15
|
+
1. setuptools>=77.3.4 (build dependency)
|
|
16
|
+
2. pygame-ce >= 2.5.3 (core of ed-game)
|
|
17
|
+
3. CPython >= 3.13
|
|
18
|
+
|
|
19
|
+
## Version Support
|
|
20
|
+
|
|
21
|
+
| Series | Status | Note |
|
|
22
|
+
|--------|--------|------|
|
|
23
|
+
| **5.x** | ✅ **Recommended** | Active development, new features |
|
|
24
|
+
| 4.x | ❌ Discontinued | Unresolved low-level OpenGL error in module `a1`; cannot be fixed |
|
|
25
|
+
| 3.x | 🛠 Maintenance | Critical bug fixes only |
|
|
26
|
+
| 2.x | 🛠 Maintenance | Critical bug fixes only |
|
|
27
|
+
|
|
28
|
+
> **Notice:** The 4.x line has reached end-of-life due to an unfixable OpenGL defect in `a1`. Please use **5.x** for new projects; 3.x remains available for legacy users who cannot upgrade.
|
|
29
|
+
|
|
30
|
+
## About
|
|
31
|
+
|
|
32
|
+
**Earth Defense Game** — a cross-platform shooter.
|
|
33
|
+
- **Windows:** accelerated via a compiled C++ extension.
|
|
34
|
+
- **Other platforms:** runs on a 100% pure-Python fallback.
|
|
@@ -63,14 +63,14 @@ EXPORT void update_all() {
|
|
|
63
63
|
if (g_boss_fire_cooldown > 0) {
|
|
64
64
|
g_boss_fire_cooldown--;
|
|
65
65
|
} else {
|
|
66
|
-
bool
|
|
66
|
+
bool any_boss_fired = false;
|
|
67
67
|
for (auto& e : g_enemies) {
|
|
68
68
|
if (e.is_boss) {
|
|
69
69
|
g_bullets.push_back({e.x, e.y + e.radius, 0.0f, 5.0f, 8, 1});
|
|
70
|
-
|
|
70
|
+
any_boss_fired = true;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
if (
|
|
73
|
+
if (any_boss_fired) g_boss_fire_cooldown = 180;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -4,16 +4,13 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ed-game"
|
|
7
|
-
version = "
|
|
7
|
+
version = "5.0.0rc2"
|
|
8
8
|
description = "Earth Defense Game"
|
|
9
9
|
authors = [{name = "qq-name", email = "your@email.com"}]
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.13"
|
|
12
12
|
license = "MIT"
|
|
13
|
-
dependencies = [
|
|
14
|
-
"pygame-ce>=2.5.3",
|
|
15
|
-
"pyglet>=2.0"
|
|
16
|
-
]
|
|
13
|
+
dependencies = ["pygame-ce>=2.5.3"]
|
|
17
14
|
|
|
18
15
|
classifiers = [
|
|
19
16
|
"Programming Language :: Python :: 3",
|
|
@@ -200,7 +200,7 @@ class StarGuardian:
|
|
|
200
200
|
self.last_boss_spawn_time = current_time
|
|
201
201
|
self.spawn_enemy(is_boss=True)
|
|
202
202
|
self.status_message = "👑 Giant Overlord Arrives! 👑"
|
|
203
|
-
self.status_msg_timer =
|
|
203
|
+
self.status_msg_timer = 180
|
|
204
204
|
|
|
205
205
|
for b in self.bullets[:]:
|
|
206
206
|
b['y'] += b['speed_y']
|
|
@@ -245,17 +245,13 @@ class StarGuardian:
|
|
|
245
245
|
self.invincible = INVINCIBLE_DURATION
|
|
246
246
|
self.add_explosion(self.player_x, self.player_y)
|
|
247
247
|
self.enemies.remove(e)
|
|
248
|
-
# BOSS 开火
|
|
249
248
|
if getattr(self, 'boss_fire_timer', 0) > 0:
|
|
250
249
|
self.boss_fire_timer -= 1
|
|
251
250
|
else:
|
|
252
|
-
fired = False
|
|
253
251
|
for e in self.enemies:
|
|
254
252
|
if e.get('is_boss'):
|
|
255
253
|
self.enemy_bullets.append({'x': e['x'], 'y': e['y'] + e['radius'], 'speed_y': 5.0, 'radius': 8})
|
|
256
|
-
|
|
257
|
-
if fired:
|
|
258
|
-
self.boss_fire_timer = 180
|
|
254
|
+
self.boss_fire_timer = 180
|
|
259
255
|
|
|
260
256
|
|
|
261
257
|
for eb in self.enemy_bullets[:]:
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ed-game
|
|
3
|
+
Version: 5.0.0rc2
|
|
4
|
+
Summary: Earth Defense Game
|
|
5
|
+
Author-email: qq-name <your@email.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://pypi.org/project/ed-game/
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.16
|
|
13
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Topic :: Games/Entertainment
|
|
17
|
+
Requires-Python: >=3.13
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: pygame-ce>=2.5.3
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
Installing:
|
|
24
|
+
|
|
25
|
+
pip install ed-game
|
|
26
|
+
|
|
27
|
+
or:
|
|
28
|
+
|
|
29
|
+
pip3 install ed-game
|
|
30
|
+
|
|
31
|
+
Usage:
|
|
32
|
+
|
|
33
|
+
import ed_game
|
|
34
|
+
ed_game.run()
|
|
35
|
+
|
|
36
|
+
ed-game dependencies:
|
|
37
|
+
1. setuptools>=77.3.4 (build dependency)
|
|
38
|
+
2. pygame-ce >= 2.5.3 (core of ed-game)
|
|
39
|
+
3. CPython >= 3.13
|
|
40
|
+
|
|
41
|
+
## Version Support
|
|
42
|
+
|
|
43
|
+
| Series | Status | Note |
|
|
44
|
+
|--------|--------|------|
|
|
45
|
+
| **5.x** | ✅ **Recommended** | Active development, new features |
|
|
46
|
+
| 4.x | ❌ Discontinued | Unresolved low-level OpenGL error in module `a1`; cannot be fixed |
|
|
47
|
+
| 3.x | 🛠 Maintenance | Critical bug fixes only |
|
|
48
|
+
| 2.x | 🛠 Maintenance | Critical bug fixes only |
|
|
49
|
+
|
|
50
|
+
> **Notice:** The 4.x line has reached end-of-life due to an unfixable OpenGL defect in `a1`. Please use **5.x** for new projects; 3.x remains available for legacy users who cannot upgrade.
|
|
51
|
+
|
|
52
|
+
## About
|
|
53
|
+
|
|
54
|
+
**Earth Defense Game** — a cross-platform shooter.
|
|
55
|
+
- **Windows:** accelerated via a compiled C++ extension.
|
|
56
|
+
- **Other platforms:** runs on a 100% pure-Python fallback.
|
|
@@ -10,6 +10,4 @@ src/ed_game.egg-info/PKG-INFO
|
|
|
10
10
|
src/ed_game.egg-info/SOURCES.txt
|
|
11
11
|
src/ed_game.egg-info/dependency_links.txt
|
|
12
12
|
src/ed_game.egg-info/requires.txt
|
|
13
|
-
src/ed_game.egg-info/top_level.txt
|
|
14
|
-
src/ed_game/new/__init__.py
|
|
15
|
-
src/ed_game/new/game.py
|
|
13
|
+
src/ed_game.egg-info/top_level.txt
|
ed_game-4.0.0.dev2/MANIFEST.in
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
include edgame_core.cpp
|
ed_game-4.0.0.dev2/PKG-INFO
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: ed-game
|
|
3
|
-
Version: 4.0.0.dev2
|
|
4
|
-
Summary: Earth Defense Game
|
|
5
|
-
Author-email: qq-name <your@email.com>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://pypi.org/project/ed-game/
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.15
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.16
|
|
13
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
14
|
-
Classifier: Operating System :: MacOS
|
|
15
|
-
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
-
Classifier: Topic :: Games/Entertainment
|
|
17
|
-
Requires-Python: >=3.13
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
License-File: LICENSE
|
|
20
|
-
Requires-Dist: pygame-ce>=2.5.3
|
|
21
|
-
Requires-Dist: pyglet>=2.0
|
|
22
|
-
Dynamic: license-file
|
|
23
|
-
|
|
24
|
-
Installing:
|
|
25
|
-
```bash
|
|
26
|
-
pip install ed-game
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
or:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
pip3 install ed-game
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Usage:
|
|
36
|
-
|
|
37
|
-
```python
|
|
38
|
-
import ed_game
|
|
39
|
-
ed_game.run()
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
ed-game dependencies:
|
|
43
|
-
|
|
44
|
-
setuptools>=77.3.4 (is build)
|
|
45
|
-
|
|
46
|
-
pygame-ce >= 2.5.3 (core of 2.x / 3.x /4.x)
|
|
47
|
-
|
|
48
|
-
pyglet >= 2.0 (core of 4.x New Game)
|
|
49
|
-
|
|
50
|
-
CPython >= 3.13
|
|
51
|
-
|
|
52
|
-
Earth Defense Game - A cross-platform shooter.
|
|
53
|
-
|
|
54
|
-
Windows: Uses a high-performance C++ extension for precise, ultra-slow enemy movement and fast collision detection.
|
|
55
|
-
|
|
56
|
-
Other platforms: Runs a 100% Pure Python fallback.
|
|
57
|
-
|
|
58
|
-
4.x New Game: A brand new implementation using the Pyglet library.
|
|
59
|
-
|
|
60
|
-
🆕 What's New in 4.0.0dev2
|
|
61
|
-
New Ed-Game Engine: Added a completely new implementation (ed_game.new) built with the Pyglet library, moving away from Pygame.
|
|
62
|
-
|
|
63
|
-
Early Access: Please note that this is an early dev release. There may be bugs and performance issues before 4.0.0rc1.
|
|
64
|
-
|
|
65
|
-
Fixed multiple Bosses firing and crown rendering.
|
|
66
|
-
|
|
67
|
-
⚠️ Known Issues
|
|
68
|
-
We have identified runtime visual bugs in ed_game 3.2.0.
|
|
69
|
-
|
|
70
|
-
These issues will be fixed in the upcoming ed_game 3.2.1 (or 3.3.0).
|
ed_game-4.0.0.dev2/README.md
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
Installing:
|
|
2
|
-
```bash
|
|
3
|
-
pip install ed-game
|
|
4
|
-
```
|
|
5
|
-
|
|
6
|
-
or:
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
pip3 install ed-game
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
Usage:
|
|
13
|
-
|
|
14
|
-
```python
|
|
15
|
-
import ed_game
|
|
16
|
-
ed_game.run()
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
ed-game dependencies:
|
|
20
|
-
|
|
21
|
-
setuptools>=77.3.4 (is build)
|
|
22
|
-
|
|
23
|
-
pygame-ce >= 2.5.3 (core of 2.x / 3.x /4.x)
|
|
24
|
-
|
|
25
|
-
pyglet >= 2.0 (core of 4.x New Game)
|
|
26
|
-
|
|
27
|
-
CPython >= 3.13
|
|
28
|
-
|
|
29
|
-
Earth Defense Game - A cross-platform shooter.
|
|
30
|
-
|
|
31
|
-
Windows: Uses a high-performance C++ extension for precise, ultra-slow enemy movement and fast collision detection.
|
|
32
|
-
|
|
33
|
-
Other platforms: Runs a 100% Pure Python fallback.
|
|
34
|
-
|
|
35
|
-
4.x New Game: A brand new implementation using the Pyglet library.
|
|
36
|
-
|
|
37
|
-
🆕 What's New in 4.0.0dev2
|
|
38
|
-
New Ed-Game Engine: Added a completely new implementation (ed_game.new) built with the Pyglet library, moving away from Pygame.
|
|
39
|
-
|
|
40
|
-
Early Access: Please note that this is an early dev release. There may be bugs and performance issues before 4.0.0rc1.
|
|
41
|
-
|
|
42
|
-
Fixed multiple Bosses firing and crown rendering.
|
|
43
|
-
|
|
44
|
-
⚠️ Known Issues
|
|
45
|
-
We have identified runtime visual bugs in ed_game 3.2.0.
|
|
46
|
-
|
|
47
|
-
These issues will be fixed in the upcoming ed_game 3.2.1 (or 3.3.0).
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .game import run
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import pyglet
|
|
2
|
-
from pyglet import shapes
|
|
3
|
-
from pyglet.window import key
|
|
4
|
-
import random
|
|
5
|
-
import math
|
|
6
|
-
|
|
7
|
-
WIDTH, HEIGHT = 1800, 1050
|
|
8
|
-
|
|
9
|
-
class NewGame:
|
|
10
|
-
def __init__(self):
|
|
11
|
-
self.window = pyglet.window.Window(WIDTH, HEIGHT, "Star Guardian 4.0.0dev1 (Pyglet)")
|
|
12
|
-
self.batch = pyglet.graphics.Batch()
|
|
13
|
-
|
|
14
|
-
self.player = shapes.Circle(WIDTH // 2, 100, 16, color=(62, 255, 250), batch=self.batch)
|
|
15
|
-
self.player_core = shapes.Circle(WIDTH // 2, 96, 6, color=(0, 204, 255), batch=self.batch)
|
|
16
|
-
|
|
17
|
-
self.bullets = []
|
|
18
|
-
self.enemies = []
|
|
19
|
-
self.particles = []
|
|
20
|
-
|
|
21
|
-
self.score = 0
|
|
22
|
-
self.lives = 3
|
|
23
|
-
self.boss_timer = 20.0
|
|
24
|
-
self.state = {"left": False, "right": False, "shoot": False, "cooldown": 0}
|
|
25
|
-
|
|
26
|
-
self.label_score = pyglet.text.Label('Score: 0', font_name='Arial', font_size=28, x=30, y=HEIGHT - 40, batch=self.batch, color=(0, 255, 255, 255))
|
|
27
|
-
self.label_lives = pyglet.text.Label('Lives: 3', font_name='Arial', font_size=28, x=WIDTH - 150, y=HEIGHT - 40, batch=self.batch, color=(255, 51, 102, 255))
|
|
28
|
-
self.label_status = pyglet.text.Label('Slow Galaxy', font_name='Arial', font_size=20, x=WIDTH//2, y=HEIGHT - 40, batch=self.batch, color=(255, 215, 0, 255), anchor_x='center')
|
|
29
|
-
|
|
30
|
-
self.window.push_handlers(self)
|
|
31
|
-
pyglet.clock.schedule_interval(self.update, 1/60.0)
|
|
32
|
-
pyglet.app.run()
|
|
33
|
-
|
|
34
|
-
def on_key_press(self, symbol, modifiers):
|
|
35
|
-
if symbol in (key.A, key.LEFT): self.state["left"] = True
|
|
36
|
-
if symbol in (key.D, key.RIGHT): self.state["right"] = True
|
|
37
|
-
if symbol in (key.SPACE, key.K, key.UP): self.state["shoot"] = True
|
|
38
|
-
if symbol == key.R: self.reset()
|
|
39
|
-
|
|
40
|
-
def on_key_release(self, symbol, modifiers):
|
|
41
|
-
if symbol in (key.A, key.LEFT): self.state["left"] = False
|
|
42
|
-
if symbol in (key.D, key.RIGHT): self.state["right"] = False
|
|
43
|
-
if symbol in (key.SPACE, key.K, key.UP): self.state["shoot"] = False
|
|
44
|
-
|
|
45
|
-
def reset(self):
|
|
46
|
-
self.score = 0
|
|
47
|
-
self.lives = 3
|
|
48
|
-
self.player.x, self.player.y = WIDTH // 2, 100
|
|
49
|
-
for b in self.bullets: b['node'].delete()
|
|
50
|
-
for e in self.enemies: e['node'].delete()
|
|
51
|
-
self.bullets.clear()
|
|
52
|
-
self.enemies.clear()
|
|
53
|
-
self.update_labels()
|
|
54
|
-
|
|
55
|
-
def update_labels(self):
|
|
56
|
-
self.label_score.text = f"Score: {self.score}"
|
|
57
|
-
self.label_lives.text = f"Lives: {self.lives}"
|
|
58
|
-
|
|
59
|
-
def on_draw(self):
|
|
60
|
-
self.window.clear()
|
|
61
|
-
self.batch.draw()
|
|
62
|
-
|
|
63
|
-
def update(self, dt):
|
|
64
|
-
if self.lives <= 0: return
|
|
65
|
-
|
|
66
|
-
# 玩家移动
|
|
67
|
-
if self.state["left"]: self.player.x -= 500 * dt
|
|
68
|
-
if self.state["right"]: self.player.x += 500 * dt
|
|
69
|
-
self.player.x = max(20, min(WIDTH - 20, self.player.x))
|
|
70
|
-
self.player_core.x = self.player.x
|
|
71
|
-
self.player_core.y = self.player.y - 4
|
|
72
|
-
|
|
73
|
-
# 玩家开火
|
|
74
|
-
self.state["cooldown"] -= dt
|
|
75
|
-
if self.state["shoot"] and self.state["cooldown"] <= 0:
|
|
76
|
-
b = shapes.Circle(self.player.x, self.player.y + 15, 5, color=(255, 255, 128), batch=self.batch)
|
|
77
|
-
self.bullets.append({"node": b, "vy": 900})
|
|
78
|
-
self.state["cooldown"] = 0.15
|
|
79
|
-
|
|
80
|
-
for b in self.bullets[:]:
|
|
81
|
-
b["node"].y += b["vy"] * dt
|
|
82
|
-
if b["node"].y > HEIGHT:
|
|
83
|
-
b["node"].delete()
|
|
84
|
-
self.bullets.remove(b)
|
|
85
|
-
|
|
86
|
-
# BOSS 生成
|
|
87
|
-
self.boss_timer -= dt
|
|
88
|
-
if self.boss_timer <= 0:
|
|
89
|
-
self.boss_timer = 30.0
|
|
90
|
-
boss = shapes.Circle(random.randint(100, WIDTH - 100), HEIGHT + 50, 48, color=(180, 50, 255), batch=self.batch)
|
|
91
|
-
|
|
92
|
-
# 画王冠 (用三角形)
|
|
93
|
-
crown = shapes.Triangle(boss.x, boss.y + 60, boss.x - 15, boss.y + 80, boss.x + 15, boss.y + 80, color=(255, 215, 0), batch=self.batch)
|
|
94
|
-
# 画血条
|
|
95
|
-
bg_bar = shapes.Rectangle(boss.x - 40, boss.y + 55, 80, 6, color=(255, 50, 50), batch=self.batch)
|
|
96
|
-
fg_bar = shapes.Rectangle(boss.x - 40, boss.y + 55, 80, 6, color=(0, 255, 0), batch=self.batch)
|
|
97
|
-
|
|
98
|
-
self.enemies.append({"node": boss, "hp": 50, "max_hp": 50, "vy": -15, "is_boss": True, "ui": {"crown": crown, "bg_bar": bg_bar, "fg_bar": fg_bar}, "cooldown": 0})
|
|
99
|
-
|
|
100
|
-
# 普通怪生成
|
|
101
|
-
if random.random() < 0.01:
|
|
102
|
-
e = shapes.Circle(random.randint(20, WIDTH - 20), HEIGHT + 20, 12, color=(255, 58, 111), batch=self.batch)
|
|
103
|
-
self.enemies.append({"node": e, "hp": 1, "max_hp": 1, "vy": -50, "is_boss": False})
|
|
104
|
-
|
|
105
|
-
# 敌人更新与 UI 同步
|
|
106
|
-
for e in self.enemies[:]:
|
|
107
|
-
e["node"].y += e["vy"] * dt
|
|
108
|
-
|
|
109
|
-
if e.get("is_boss") and "ui" in e:
|
|
110
|
-
e["ui"]["crown"].x = e["node"].x
|
|
111
|
-
e["ui"]["crown"].y = e["node"].y
|
|
112
|
-
e["ui"]["bg_bar"].x = e["node"].x - 40
|
|
113
|
-
e["ui"]["bg_bar"].y = e["node"].y + 55
|
|
114
|
-
e["ui"]["fg_bar"].x = e["node"].x - 40
|
|
115
|
-
e["ui"]["fg_bar"].y = e["node"].y + 55
|
|
116
|
-
e["ui"]["fg_bar"].width = 80 * (e["hp"] / e["max_hp"])
|
|
117
|
-
|
|
118
|
-
# BOSS 开火逻辑 (Pyglet版)
|
|
119
|
-
e["cooldown"] -= dt
|
|
120
|
-
if e["cooldown"] <= 0:
|
|
121
|
-
b = shapes.Circle(e["node"].x, e["node"].y - 48, 8, color=(255, 0, 0), batch=self.batch)
|
|
122
|
-
self.bullets.append({"node": b, "vy": -400, "is_enemy": True})
|
|
123
|
-
e["cooldown"] = 3.0 # 3秒开火一次
|
|
124
|
-
|
|
125
|
-
# 碰撞玩家
|
|
126
|
-
if math.hypot(self.player.x - e["node"].x, self.player.y - e["node"].y) < 16 + e["node"].radius:
|
|
127
|
-
self.lives -= 1
|
|
128
|
-
self.update_labels()
|
|
129
|
-
self.create_explosion(e["node"].x, e["node"].y)
|
|
130
|
-
if "ui" in e:
|
|
131
|
-
for u in e["ui"].values(): u.delete()
|
|
132
|
-
e["node"].delete()
|
|
133
|
-
self.enemies.remove(e)
|
|
134
|
-
if self.lives <= 0: return
|
|
135
|
-
continue
|
|
136
|
-
|
|
137
|
-
if e["node"].y < -100:
|
|
138
|
-
if "ui" in e:
|
|
139
|
-
for u in e["ui"].values(): u.delete()
|
|
140
|
-
e["node"].delete()
|
|
141
|
-
self.enemies.remove(e)
|
|
142
|
-
|
|
143
|
-
# 子弹与敌人碰撞
|
|
144
|
-
for b in self.bullets[:]:
|
|
145
|
-
if b.get("is_enemy"): continue # 敌人的子弹不打敌人
|
|
146
|
-
for e in self.enemies[:]:
|
|
147
|
-
if math.hypot(b["node"].x - e["node"].x, b["node"].y - e["node"].y) < 5 + e["node"].radius:
|
|
148
|
-
e["hp"] -= 1
|
|
149
|
-
b["node"].delete()
|
|
150
|
-
self.bullets.remove(b)
|
|
151
|
-
if e["hp"] <= 0:
|
|
152
|
-
self.score += 200 if e.get("is_boss") else 10
|
|
153
|
-
self.update_labels()
|
|
154
|
-
self.create_explosion(e["node"].x, e["node"].y)
|
|
155
|
-
if "ui" in e:
|
|
156
|
-
for u in e["ui"].values(): u.delete()
|
|
157
|
-
e["node"].delete()
|
|
158
|
-
self.enemies.remove(e)
|
|
159
|
-
break
|
|
160
|
-
|
|
161
|
-
# 敌人的子弹打玩家
|
|
162
|
-
for b in self.bullets[:]:
|
|
163
|
-
if b.get("is_enemy"):
|
|
164
|
-
if math.hypot(self.player.x - b["node"].x, self.player.y - b["node"].y) < 16 + b["node"].radius:
|
|
165
|
-
self.lives -= 1
|
|
166
|
-
self.update_labels()
|
|
167
|
-
b["node"].delete()
|
|
168
|
-
self.bullets.remove(b)
|
|
169
|
-
if self.lives <= 0: return
|
|
170
|
-
|
|
171
|
-
for p in self.particles[:]:
|
|
172
|
-
p["node"].x += p["vx"] * dt
|
|
173
|
-
p["node"].y += p["vy"] * dt
|
|
174
|
-
p["life"] -= 1
|
|
175
|
-
if p["life"] <= 0:
|
|
176
|
-
p["node"].delete()
|
|
177
|
-
self.particles.remove(p)
|
|
178
|
-
|
|
179
|
-
def create_explosion(self, x, y):
|
|
180
|
-
for _ in range(8):
|
|
181
|
-
p = shapes.Circle(x, y, random.uniform(2, 5), color=(255, random.randint(100, 200), 50), batch=self.batch)
|
|
182
|
-
self.particles.append({"node": p, "vx": random.uniform(-300, 300), "vy": random.uniform(-300, 300), "life": 0.5})
|
|
183
|
-
|
|
184
|
-
def run():
|
|
185
|
-
NewGame()
|
|
186
|
-
run()
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: ed-game
|
|
3
|
-
Version: 4.0.0.dev2
|
|
4
|
-
Summary: Earth Defense Game
|
|
5
|
-
Author-email: qq-name <your@email.com>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://pypi.org/project/ed-game/
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.15
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.16
|
|
13
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
14
|
-
Classifier: Operating System :: MacOS
|
|
15
|
-
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
-
Classifier: Topic :: Games/Entertainment
|
|
17
|
-
Requires-Python: >=3.13
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
License-File: LICENSE
|
|
20
|
-
Requires-Dist: pygame-ce>=2.5.3
|
|
21
|
-
Requires-Dist: pyglet>=2.0
|
|
22
|
-
Dynamic: license-file
|
|
23
|
-
|
|
24
|
-
Installing:
|
|
25
|
-
```bash
|
|
26
|
-
pip install ed-game
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
or:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
pip3 install ed-game
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Usage:
|
|
36
|
-
|
|
37
|
-
```python
|
|
38
|
-
import ed_game
|
|
39
|
-
ed_game.run()
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
ed-game dependencies:
|
|
43
|
-
|
|
44
|
-
setuptools>=77.3.4 (is build)
|
|
45
|
-
|
|
46
|
-
pygame-ce >= 2.5.3 (core of 2.x / 3.x /4.x)
|
|
47
|
-
|
|
48
|
-
pyglet >= 2.0 (core of 4.x New Game)
|
|
49
|
-
|
|
50
|
-
CPython >= 3.13
|
|
51
|
-
|
|
52
|
-
Earth Defense Game - A cross-platform shooter.
|
|
53
|
-
|
|
54
|
-
Windows: Uses a high-performance C++ extension for precise, ultra-slow enemy movement and fast collision detection.
|
|
55
|
-
|
|
56
|
-
Other platforms: Runs a 100% Pure Python fallback.
|
|
57
|
-
|
|
58
|
-
4.x New Game: A brand new implementation using the Pyglet library.
|
|
59
|
-
|
|
60
|
-
🆕 What's New in 4.0.0dev2
|
|
61
|
-
New Ed-Game Engine: Added a completely new implementation (ed_game.new) built with the Pyglet library, moving away from Pygame.
|
|
62
|
-
|
|
63
|
-
Early Access: Please note that this is an early dev release. There may be bugs and performance issues before 4.0.0rc1.
|
|
64
|
-
|
|
65
|
-
Fixed multiple Bosses firing and crown rendering.
|
|
66
|
-
|
|
67
|
-
⚠️ Known Issues
|
|
68
|
-
We have identified runtime visual bugs in ed_game 3.2.0.
|
|
69
|
-
|
|
70
|
-
These issues will be fixed in the upcoming ed_game 3.2.1 (or 3.3.0).
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|