ed-game 4.0.0.dev1__tar.gz → 4.0.0.dev2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ed-game
3
- Version: 4.0.0.dev1
3
+ Version: 4.0.0.dev2
4
4
  Summary: Earth Defense Game
5
5
  Author-email: qq-name <your@email.com>
6
6
  License-Expression: MIT
@@ -51,18 +51,20 @@ CPython >= 3.13
51
51
 
52
52
  Earth Defense Game - A cross-platform shooter.
53
53
 
54
- Windows / 2.x & 3.x: Uses a high-performance C++ extension for precise, ultra-slow enemy movement and fast collision detection.
54
+ Windows: Uses a high-performance C++ extension for precise, ultra-slow enemy movement and fast collision detection.
55
55
 
56
- Other platforms / 2.x & 3.x: Runs a 100% Pure Python fallback.
56
+ Other platforms: Runs a 100% Pure Python fallback.
57
57
 
58
58
  4.x New Game: A brand new implementation using the Pyglet library.
59
59
 
60
- 🆕 What's New in 4.0.0dev1
60
+ 🆕 What's New in 4.0.0dev2
61
61
  New Ed-Game Engine: Added a completely new implementation (ed_game.new) built with the Pyglet library, moving away from Pygame.
62
62
 
63
63
  Early Access: Please note that this is an early dev release. There may be bugs and performance issues before 4.0.0rc1.
64
64
 
65
+ Fixed multiple Bosses firing and crown rendering.
66
+
65
67
  ⚠️ Known Issues
66
- We have identified runtime visual bugs in ed_game 4.0.0dev1 and ed_game 3.2.0.
68
+ We have identified runtime visual bugs in ed_game 3.2.0.
67
69
 
68
- These issues will be fixed in the upcoming ed_game 4.0.0dev2 and ed_game 3.2.1 (or 3.3.0).
70
+ These issues will be fixed in the upcoming ed_game 3.2.1 (or 3.3.0).
@@ -28,18 +28,20 @@ CPython >= 3.13
28
28
 
29
29
  Earth Defense Game - A cross-platform shooter.
30
30
 
31
- Windows / 2.x & 3.x: Uses a high-performance C++ extension for precise, ultra-slow enemy movement and fast collision detection.
31
+ Windows: Uses a high-performance C++ extension for precise, ultra-slow enemy movement and fast collision detection.
32
32
 
33
- Other platforms / 2.x & 3.x: Runs a 100% Pure Python fallback.
33
+ Other platforms: Runs a 100% Pure Python fallback.
34
34
 
35
35
  4.x New Game: A brand new implementation using the Pyglet library.
36
36
 
37
- 🆕 What's New in 4.0.0dev1
37
+ 🆕 What's New in 4.0.0dev2
38
38
  New Ed-Game Engine: Added a completely new implementation (ed_game.new) built with the Pyglet library, moving away from Pygame.
39
39
 
40
40
  Early Access: Please note that this is an early dev release. There may be bugs and performance issues before 4.0.0rc1.
41
41
 
42
+ Fixed multiple Bosses firing and crown rendering.
43
+
42
44
  ⚠️ Known Issues
43
- We have identified runtime visual bugs in ed_game 4.0.0dev1 and ed_game 3.2.0.
45
+ We have identified runtime visual bugs in ed_game 3.2.0.
44
46
 
45
- These issues will be fixed in the upcoming ed_game 4.0.0dev2 and ed_game 3.2.1 (or 3.3.0).
47
+ These issues will be fixed in the upcoming ed_game 3.2.1 (or 3.3.0).
@@ -63,13 +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 fired = false;
66
67
  for (auto& e : g_enemies) {
67
68
  if (e.is_boss) {
68
69
  g_bullets.push_back({e.x, e.y + e.radius, 0.0f, 5.0f, 8, 1});
69
- g_boss_fire_cooldown = 60;
70
- break;
70
+ fired = true;
71
71
  }
72
72
  }
73
+ if (fired) g_boss_fire_cooldown = 180;
73
74
  }
74
75
  }
75
76
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ed-game"
7
- version = "4.0.0dev1"
7
+ version = "4.0.0dev2"
8
8
  description = "Earth Defense Game"
9
9
  authors = [{name = "qq-name", email = "your@email.com"}]
10
10
  readme = "README.md"
@@ -31,7 +31,7 @@ BASE_SPAWN_DELAY = 48
31
31
  STAR_COUNT = 220
32
32
  BOSS_SIZE_MULTIPLIER = 4
33
33
  BOSS_SPAWN_INTERVAL = 20 * 1000
34
- NUKE_COOLDOWN = 120 * 1000
34
+ NUKE_COOLDOWN = 7.2 * 1000
35
35
 
36
36
  lib = None
37
37
 
@@ -29,7 +29,7 @@ BASE_SPAWN_DELAY = 48
29
29
  STAR_COUNT = 220
30
30
  BOSS_SIZE_MULTIPLIER = 4
31
31
  BOSS_SPAWN_INTERVAL = 20 * 1000
32
- NUKE_COOLDOWN = 120 * 1000
32
+ NUKE_COOLDOWN = 7.2 * 1000
33
33
 
34
34
  def generate_sound(frequency, duration, volume=0.5, type='square'):
35
35
  sample_rate = 22050
@@ -245,15 +245,17 @@ 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 开火
248
+ # BOSS 开火
249
249
  if getattr(self, 'boss_fire_timer', 0) > 0:
250
250
  self.boss_fire_timer -= 1
251
251
  else:
252
+ fired = False
252
253
  for e in self.enemies:
253
254
  if e.get('is_boss'):
254
255
  self.enemy_bullets.append({'x': e['x'], 'y': e['y'] + e['radius'], 'speed_y': 5.0, 'radius': 8})
255
- self.boss_fire_timer = 60
256
- break
256
+ fired = True
257
+ if fired:
258
+ self.boss_fire_timer = 180
257
259
 
258
260
 
259
261
  for eb in self.enemy_bullets[:]:
@@ -63,12 +63,14 @@ class NewGame:
63
63
  def update(self, dt):
64
64
  if self.lives <= 0: return
65
65
 
66
+ # 玩家移动
66
67
  if self.state["left"]: self.player.x -= 500 * dt
67
68
  if self.state["right"]: self.player.x += 500 * dt
68
69
  self.player.x = max(20, min(WIDTH - 20, self.player.x))
69
70
  self.player_core.x = self.player.x
70
71
  self.player_core.y = self.player.y - 4
71
72
 
73
+ # 玩家开火
72
74
  self.state["cooldown"] -= dt
73
75
  if self.state["shoot"] and self.state["cooldown"] <= 0:
74
76
  b = shapes.Circle(self.player.x, self.player.y + 15, 5, color=(255, 255, 128), batch=self.batch)
@@ -81,31 +83,46 @@ class NewGame:
81
83
  b["node"].delete()
82
84
  self.bullets.remove(b)
83
85
 
86
+ # BOSS 生成
84
87
  self.boss_timer -= dt
85
88
  if self.boss_timer <= 0:
86
- self.boss_timer = 20.0
89
+ self.boss_timer = 30.0
87
90
  boss = shapes.Circle(random.randint(100, WIDTH - 100), HEIGHT + 50, 48, color=(180, 50, 255), batch=self.batch)
88
- self.enemies.append({"node": boss, "hp": 50, "max_hp": 50, "vy": -15, "is_boss": True})
89
91
 
90
- crown = shapes.Polygon([(boss.x - 20, boss.y + 40), (boss.x, boss.y + 60), (boss.x + 20, boss.y + 40)], color=(255, 215, 0), batch=self.batch)
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
+ # 画血条
91
95
  bg_bar = shapes.Rectangle(boss.x - 40, boss.y + 55, 80, 6, color=(255, 50, 50), batch=self.batch)
92
96
  fg_bar = shapes.Rectangle(boss.x - 40, boss.y + 55, 80, 6, color=(0, 255, 0), batch=self.batch)
93
- boss["ui"] = {"crown": crown, "bg_bar": bg_bar, "fg_bar": fg_bar}
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})
94
99
 
95
- if random.random() < 0.03:
100
+ # 普通怪生成
101
+ if random.random() < 0.01:
96
102
  e = shapes.Circle(random.randint(20, WIDTH - 20), HEIGHT + 20, 12, color=(255, 58, 111), batch=self.batch)
97
- self.enemies.append({"node": e, "hp": 1, "max_hp": 1, "vy": -80, "is_boss": False})
103
+ self.enemies.append({"node": e, "hp": 1, "max_hp": 1, "vy": -50, "is_boss": False})
98
104
 
105
+ # 敌人更新与 UI 同步
99
106
  for e in self.enemies[:]:
100
107
  e["node"].y += e["vy"] * dt
108
+
101
109
  if e.get("is_boss") and "ui" in e:
102
- ui = e["ui"]
103
- ui["bg_bar"].x = e["node"].x - 40
104
- ui["bg_bar"].y = e["node"].y + 55
105
- ui["fg_bar"].x = e["node"].x - 40
106
- ui["fg_bar"].y = e["node"].y + 55
107
- ui["fg_bar"].width = 80 * (e["hp"] / e["max_hp"])
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秒开火一次
108
124
 
125
+ # 碰撞玩家
109
126
  if math.hypot(self.player.x - e["node"].x, self.player.y - e["node"].y) < 16 + e["node"].radius:
110
127
  self.lives -= 1
111
128
  self.update_labels()
@@ -123,13 +140,14 @@ class NewGame:
123
140
  e["node"].delete()
124
141
  self.enemies.remove(e)
125
142
 
143
+ # 子弹与敌人碰撞
126
144
  for b in self.bullets[:]:
145
+ if b.get("is_enemy"): continue # 敌人的子弹不打敌人
127
146
  for e in self.enemies[:]:
128
147
  if math.hypot(b["node"].x - e["node"].x, b["node"].y - e["node"].y) < 5 + e["node"].radius:
129
148
  e["hp"] -= 1
130
149
  b["node"].delete()
131
150
  self.bullets.remove(b)
132
-
133
151
  if e["hp"] <= 0:
134
152
  self.score += 200 if e.get("is_boss") else 10
135
153
  self.update_labels()
@@ -139,15 +157,25 @@ class NewGame:
139
157
  e["node"].delete()
140
158
  self.enemies.remove(e)
141
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
142
170
 
143
171
  for p in self.particles[:]:
144
172
  p["node"].x += p["vx"] * dt
145
173
  p["node"].y += p["vy"] * dt
146
- p["life"] -= dt
174
+ p["life"] -= 1
147
175
  if p["life"] <= 0:
148
176
  p["node"].delete()
149
177
  self.particles.remove(p)
150
-
178
+
151
179
  def create_explosion(self, x, y):
152
180
  for _ in range(8):
153
181
  p = shapes.Circle(x, y, random.uniform(2, 5), color=(255, random.randint(100, 200), 50), batch=self.batch)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ed-game
3
- Version: 4.0.0.dev1
3
+ Version: 4.0.0.dev2
4
4
  Summary: Earth Defense Game
5
5
  Author-email: qq-name <your@email.com>
6
6
  License-Expression: MIT
@@ -51,18 +51,20 @@ CPython >= 3.13
51
51
 
52
52
  Earth Defense Game - A cross-platform shooter.
53
53
 
54
- Windows / 2.x & 3.x: Uses a high-performance C++ extension for precise, ultra-slow enemy movement and fast collision detection.
54
+ Windows: Uses a high-performance C++ extension for precise, ultra-slow enemy movement and fast collision detection.
55
55
 
56
- Other platforms / 2.x & 3.x: Runs a 100% Pure Python fallback.
56
+ Other platforms: Runs a 100% Pure Python fallback.
57
57
 
58
58
  4.x New Game: A brand new implementation using the Pyglet library.
59
59
 
60
- 🆕 What's New in 4.0.0dev1
60
+ 🆕 What's New in 4.0.0dev2
61
61
  New Ed-Game Engine: Added a completely new implementation (ed_game.new) built with the Pyglet library, moving away from Pygame.
62
62
 
63
63
  Early Access: Please note that this is an early dev release. There may be bugs and performance issues before 4.0.0rc1.
64
64
 
65
+ Fixed multiple Bosses firing and crown rendering.
66
+
65
67
  ⚠️ Known Issues
66
- We have identified runtime visual bugs in ed_game 4.0.0dev1 and ed_game 3.2.0.
68
+ We have identified runtime visual bugs in ed_game 3.2.0.
67
69
 
68
- These issues will be fixed in the upcoming ed_game 4.0.0dev2 and ed_game 3.2.1 (or 3.3.0).
70
+ These issues will be fixed in the upcoming ed_game 3.2.1 (or 3.3.0).
@@ -11,5 +11,5 @@ 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
13
  src/ed_game.egg-info/top_level.txt
14
- src/new/__init__.py
15
- src/new/game.py
14
+ src/ed_game/new/__init__.py
15
+ src/ed_game/new/game.py
File without changes
File without changes
File without changes