ed-game 5.0.0__py3-none-win_amd64.whl

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/__init__.py ADDED
@@ -0,0 +1,45 @@
1
+ """ed-game __init__.py"""
2
+
3
+ import sys
4
+ import os
5
+
6
+ # ===== pygame-ce =====
7
+ def _check():
8
+ try:
9
+ import pygame
10
+ return True
11
+ except ImportError:
12
+ raise ImportError("pygame-ce not installed. Run: pip install pygame-ce")
13
+
14
+ if not _check():
15
+ sys.exit(1)
16
+
17
+ # ===== Dynamic Module Selection =====
18
+ _game = None
19
+
20
+ if os.path.exists(os.path.join(os.path.dirname(__file__), 'edgame_core.dll')):
21
+ print("====================================")
22
+ print("1. C++ High-Performance Mode")
23
+ print("2. Pure Python Compatibility Mode")
24
+ print("====================================")
25
+ choice = input("Select mode (1/2, default is 1): ")
26
+
27
+ if choice == '2':
28
+ from . import game_2 as _game
29
+ else:
30
+ from . import game_1 as _game
31
+ else:
32
+ print('DLL is not found! Directory is corrupted! Run 100% Python...')
33
+ from . import game_2 as _game
34
+
35
+ FPS = _game.FPS
36
+
37
+ # ===== Public API =====
38
+ def run(speed_multiplier=1.0):
39
+ game = _game.StarGuardian(speed_multiplier=speed_multiplier)
40
+ game.run()
41
+
42
+ del _check
43
+
44
+ __version__ = "5.0.0"
45
+ __all__ = ["run", "FPS"]
Binary file
ed_game/game_1.py ADDED
@@ -0,0 +1,436 @@
1
+ import pygame
2
+ import random
3
+ import math
4
+ import sys
5
+ import ctypes
6
+ import os
7
+ import array
8
+
9
+ WIDTH = 1800
10
+ HEIGHT = 1050
11
+ FPS = 60
12
+
13
+ COLORS = {
14
+ 'bg': (2, 6, 23), 'enemy': (255, 58, 111), 'enemy_elite': (255, 136, 68),
15
+ 'enemy_boss': (180, 50, 255), 'bullet': (255, 255, 128), 'bullet_core': (255, 204, 68),
16
+ 'player_main': (62, 255, 250), 'player_core': (0, 204, 255), 'player_fire': (255, 102, 0),
17
+ 'score': (0, 255, 255), 'lives': (255, 51, 102), 'status': (255, 215, 0),
18
+ 'gameover': (255, 68, 102), 'white': (255, 255, 255), 'gold': (255, 215, 0), 'heart': (255, 80, 120),
19
+ }
20
+
21
+ BASE_ENEMY_SPEED = 0.31
22
+ MAX_ENEMY_SPEED = 0.85
23
+ ELITE_SPEED_FACTOR = 0.84
24
+ BOSS_SPEED_FACTOR = 0.2
25
+ BULLET_SPEED = -8.5
26
+ PLAYER_SPEED = 6.2
27
+ PLAYER_RADIUS = 15
28
+ INVINCIBLE_DURATION = 55
29
+ SHOOT_COOLDOWN_FRAMES = 9
30
+ BASE_SPAWN_DELAY = 48
31
+ STAR_COUNT = 220
32
+ BOSS_SIZE_MULTIPLIER = 4
33
+ BOSS_SPAWN_INTERVAL = 20 * 1000
34
+ NUKE_COOLDOWN = 7.2 * 1000
35
+
36
+ lib = None
37
+
38
+ def generate_sound(frequency, duration, volume=0.5, type='square'):
39
+ sample_rate = 22050
40
+ n_samples = int(sample_rate * duration)
41
+ buf = array.array('h', [0] * n_samples)
42
+ for i in range(n_samples):
43
+ t = float(i) / sample_rate
44
+ if type == 'square':
45
+ val = 1.0 if math.sin(2 * math.pi * frequency * t) > 0 else -1.0
46
+ else:
47
+ val = math.sin(2 * math.pi * frequency * t)
48
+ envelope = max(0.0, 1.0 - (i / n_samples))
49
+ buf[i] = int(val * volume * envelope * 32767)
50
+ return pygame.mixer.Sound(buffer=buf.tobytes())
51
+
52
+ def load_dll():
53
+ global lib
54
+ try:
55
+ lib_dir = os.path.dirname(__file__)
56
+ lib_path = os.path.join(lib_dir, 'edgame_core.dll')
57
+ lib = ctypes.CDLL(lib_path)
58
+ return True
59
+ except Exception:
60
+ return False
61
+
62
+ class CBullet(ctypes.Structure):
63
+ _fields_ = [("x", ctypes.c_float), ("y", ctypes.c_float), ("speed_x", ctypes.c_float), ("speed_y", ctypes.c_float), ("radius", ctypes.c_int32), ("damage", ctypes.c_int32)]
64
+ class CEnemy(ctypes.Structure):
65
+ _fields_ = [("x", ctypes.c_float), ("y", ctypes.c_float), ("speed_y", ctypes.c_float), ("radius", ctypes.c_int32), ("hp", ctypes.c_int32), ("max_hp", ctypes.c_int32), ("elite", ctypes.c_int32), ("is_boss", ctypes.c_int32)]
66
+
67
+ class KillInfo(ctypes.Structure):
68
+ _fields_ = [("x", ctypes.c_float), ("y", ctypes.c_float), ("score", ctypes.c_int32), ("is_boss", ctypes.c_int32), ("elite", ctypes.c_int32)]
69
+
70
+ def setup_c_functions():
71
+ if lib is None: return
72
+ lib.update_all.restype = None
73
+ lib.add_bullet.argtypes = (ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_int32, ctypes.c_int32)
74
+ lib.add_bullet.restype = ctypes.c_int32
75
+ lib.add_enemy.argtypes = (ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_int32, ctypes.c_int32, ctypes.c_int32, ctypes.c_int32, ctypes.c_int32)
76
+ lib.add_enemy.restype = ctypes.c_int32
77
+ lib.clear_all.restype = None
78
+ lib.get_bullet_count.restype = ctypes.c_int32
79
+ lib.get_enemy_count.restype = ctypes.c_int32
80
+ lib.get_bullets.argtypes = (ctypes.POINTER(CBullet),)
81
+ lib.get_enemies.argtypes = (ctypes.POINTER(CEnemy),)
82
+ lib.remove_offscreen_bullets.argtypes = (ctypes.c_float, ctypes.c_float)
83
+ lib.remove_offscreen_bullets.restype = ctypes.c_int32
84
+ lib.remove_offscreen_enemies.argtypes = (ctypes.c_float,)
85
+ lib.remove_offscreen_enemies.restype = ctypes.c_int32
86
+ lib.process_bullet_enemy_collision.argtypes = (ctypes.POINTER(KillInfo), ctypes.c_int32)
87
+ lib.process_bullet_enemy_collision.restype = ctypes.c_int32
88
+ lib.process_player_enemy_collision.argtypes = (ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float))
89
+ lib.process_player_enemy_collision.restype = ctypes.c_int32
90
+
91
+ class StarGuardian:
92
+ def __init__(self, speed_multiplier=1.0):
93
+ pygame.init()
94
+ pygame.mixer.init(frequency=22050, size=-16, channels=1)
95
+
96
+ self.screen = pygame.display.set_mode((WIDTH, HEIGHT))
97
+ pygame.display.set_caption("Star Guardian 3.1.0 · Mobile & PC")
98
+ self.clock = pygame.time.Clock()
99
+ self.speed_multiplier = speed_multiplier
100
+
101
+ self.sfx_shoot = generate_sound(800, 0.05, 0.3, 'square')
102
+ self.sfx_boom = generate_sound(100, 0.3, 0.6, 'sine')
103
+
104
+ self.bullet_surface = pygame.Surface((12, 12), pygame.SRCALPHA)
105
+ pygame.draw.circle(self.bullet_surface, COLORS['bullet'], (6, 6), 5)
106
+ pygame.draw.circle(self.bullet_surface, COLORS['bullet_core'], (6, 6), 3)
107
+
108
+ self.player_surface = pygame.Surface((40, 40), pygame.SRCALPHA)
109
+ pygame.draw.circle(self.player_surface, COLORS['player_main'], (20, 20), 16)
110
+ pygame.draw.circle(self.player_surface, COLORS['player_core'], (20, 16), 6)
111
+ pygame.draw.circle(self.player_surface, COLORS['white'], (17, 14), 2)
112
+ pygame.draw.circle(self.player_surface, COLORS['white'], (23, 14), 2)
113
+ pygame.draw.circle(self.player_surface, COLORS['player_fire'], (20, 38), 6)
114
+ pygame.draw.circle(self.player_surface, COLORS['player_fire'], (17, 36), 4)
115
+ pygame.draw.circle(self.player_surface, COLORS['player_fire'], (23, 36), 4)
116
+
117
+ self.stars = []
118
+ for _ in range(250):
119
+ self.stars.append({
120
+ 'x': random.randint(0, WIDTH),
121
+ 'y': random.randint(0, HEIGHT),
122
+ 'radius': random.uniform(1.0, 2.5)
123
+ })
124
+ self.stars = []
125
+ for _ in range(250):
126
+ self.stars.append({
127
+ 'x': random.randint(0, WIDTH),
128
+ 'y': random.randint(0, HEIGHT),
129
+ 'radius': random.uniform(1.0, 2.5)
130
+ })
131
+
132
+ self._load_fonts()
133
+ load_dll()
134
+ setup_c_functions()
135
+ self.high_score = 0
136
+ self.reset_game()
137
+
138
+ def _load_fonts(self):
139
+ self.font_large = pygame.font.SysFont("arial", 48, bold=True)
140
+ self.font_medium = pygame.font.SysFont("arial", 28, bold=True)
141
+ self.font_small = pygame.font.SysFont("arial", 20)
142
+ self.font_tiny = pygame.font.SysFont("arial", 14)
143
+ self._text_cache = {}
144
+
145
+ def render_text(self, text, font, color):
146
+ key = (text, id(font), color)
147
+ if key not in self._text_cache:
148
+ self._text_cache[key] = font.render(text, True, color)
149
+ return self._text_cache[key]
150
+
151
+ def reset_game(self):
152
+ if hasattr(self, 'score'):
153
+ self.high_score = max(self.high_score, self.score)
154
+
155
+ self.game_active = True
156
+ self.score = 0
157
+ self.wave_level = 1
158
+ self.lives = 3
159
+ self.invincible = 0
160
+ self.player_x = WIDTH // 2
161
+ self.player_y = HEIGHT - 60
162
+ self.shoot_cooldown = 0
163
+ self.nuke_timer = 0
164
+ self.screen_shake = 0
165
+ self.flash_timer = 0
166
+ self.enemies = []
167
+ self.bullets = []
168
+ self.explosions = []
169
+ self.particles = []
170
+ self.player_trail = []
171
+ self.enemy_spawn_timer = 20
172
+ self.spawn_delay_current = BASE_SPAWN_DELAY
173
+ self.last_boss_spawn_time = pygame.time.get_ticks()
174
+
175
+ self.btn_left = False
176
+ self.btn_right = False
177
+ self.btn_fire = False
178
+
179
+ if lib is not None: lib.clear_all()
180
+ for _ in range(3): self.spawn_enemy()
181
+
182
+ def spawn_enemy(self, is_boss=False):
183
+ if lib is None: return
184
+
185
+ if is_boss:
186
+ radius = 12 * BOSS_SIZE_MULTIPLIER
187
+ x = random.randint(radius, WIDTH - radius)
188
+ speed = (0.06) * self.speed_multiplier
189
+ hp = 50
190
+ lib.add_enemy(float(x), float(-radius), float(speed), radius, hp, hp, 0, 1)
191
+ else:
192
+ radius = 12
193
+ x = random.randint(radius, WIDTH - radius)
194
+ speed = 0.31 * self.speed_multiplier
195
+ hp = 1
196
+
197
+ is_elite = (random.random() < 0.18)
198
+ if is_elite:
199
+ radius = 16
200
+ hp = 2
201
+ speed *= 0.84
202
+
203
+ lib.add_enemy(float(x), float(-radius), float(speed), radius, hp, hp, 1 if is_elite else 0, 0)
204
+ def add_explosion(self, px, py, is_boss=False):
205
+ self.explosions.append({'x': px, 'y': py, 'life': 6 if not is_boss else 20, 'max_life': 6 if not is_boss else 20, 'radius': 12 if not is_boss else 30})
206
+ for _ in range(8 if not is_boss else 30):
207
+ self.particles.append({'x': px, 'y': py, 'vx': (random.random() - 0.5) * 3.5, 'vy': (random.random() - 0.5) * 3 - 1, 'life': 6 if not is_boss else 20, 'size': random.random() * 3 + 1.5, 'color': (255, random.randint(100, 255), 50)})
208
+
209
+ def update(self):
210
+ if not self.game_active: return
211
+ if self.invincible > 0: self.invincible -= 1
212
+ if self.shoot_cooldown > 0: self.shoot_cooldown -= 1
213
+ if self.nuke_timer > 0: self.nuke_timer -= 1
214
+
215
+ if self.btn_left: self.player_x -= PLAYER_SPEED
216
+ if self.btn_right: self.player_x += PLAYER_SPEED
217
+ self.player_x = max(PLAYER_RADIUS + 5, min(WIDTH - PLAYER_RADIUS - 5, self.player_x))
218
+
219
+ if self.btn_fire and self.shoot_cooldown == 0:
220
+ if lib is not None:
221
+ # x, y, speed_x(0.0), speed_y, radius, damage
222
+ lib.add_bullet(float(self.player_x), float(self.player_y - 12), 0.0, float(BULLET_SPEED), 5, 1)
223
+ self.sfx_shoot.play()
224
+ self.shoot_cooldown = SHOOT_COOLDOWN_FRAMES
225
+
226
+ # BOSS Spawn Timer
227
+ current_time = pygame.time.get_ticks()
228
+ if current_time - self.last_boss_spawn_time >= BOSS_SPAWN_INTERVAL:
229
+ self.last_boss_spawn_time = current_time
230
+ self.spawn_enemy(is_boss=True)
231
+
232
+ if lib is not None:
233
+ lib.update_all()
234
+ lib.remove_offscreen_bullets(float(WIDTH), float(HEIGHT))
235
+ lib.remove_offscreen_enemies(float(HEIGHT))
236
+
237
+ kills = (KillInfo * 256)()
238
+ kill_count = lib.process_bullet_enemy_collision(kills, 256)
239
+ for k in range(kill_count):
240
+ ki = kills[k]
241
+ self.score += ki.score
242
+
243
+ # Update wave level for elite spawns
244
+ raw_wave = min(1 + self.score // 550, 9)
245
+ if raw_wave > self.wave_level:
246
+ self.wave_level = raw_wave
247
+ self.spawn_delay_current = max(20, 48 - int(self.wave_level * 2))
248
+
249
+ self.add_explosion(ki.x, ki.y, is_boss=bool(ki.is_boss))
250
+ self.sfx_boom.play()
251
+
252
+ out_x, out_y = ctypes.c_float(0), ctypes.c_float(0)
253
+ hit = lib.process_player_enemy_collision(float(self.player_x), float(self.player_y), float(PLAYER_RADIUS), ctypes.byref(out_x), ctypes.byref(out_y))
254
+ if hit and self.invincible <= 0 and self.game_active:
255
+ self.lives -= 1
256
+ self.screen_shake = 15
257
+ if self.lives <= 0:
258
+ self.lives = 0
259
+ self.game_active = False
260
+ return
261
+ else:
262
+ self.invincible = INVINCIBLE_DURATION
263
+ self.add_explosion(self.player_x, self.player_y)
264
+
265
+ self.enemy_spawn_timer -= 1
266
+ if self.enemy_spawn_timer <= 0:
267
+ self.spawn_enemy()
268
+ self.enemy_spawn_timer = self.spawn_delay_current
269
+
270
+ for p in self.particles[:]:
271
+ p['x'] += p['vx']
272
+ p['y'] += p['vy']
273
+ p['life'] -= 1
274
+ if p['life'] <= 0: self.particles.remove(p)
275
+ for ex in self.explosions[:]:
276
+ ex['life'] -= 1
277
+ if ex['life'] <= 0: self.explosions.remove(ex)
278
+
279
+ self.player_trail.append((self.player_x, self.player_y))
280
+ if len(self.player_trail) > 6: self.player_trail.pop(0)
281
+
282
+ def draw(self):
283
+ shake_x = random.randint(-8, 8) if self.screen_shake > 0 else 0
284
+ shake_y = random.randint(-8, 8) if self.screen_shake > 0 else 0
285
+ if self.screen_shake > 0: self.screen_shake -= 1
286
+
287
+ self.screen.fill(COLORS['bg'])
288
+
289
+ for star in self.stars:
290
+ pygame.draw.circle(self.screen, (255, 240, 200), (int(star['x']), int(star['y'])), int(star['radius']))
291
+
292
+ if lib is not None:
293
+ n_e = lib.get_enemy_count()
294
+ if n_e > 0:
295
+ arr_e = (CEnemy * n_e)()
296
+ lib.get_enemies(arr_e)
297
+ for e in arr_e:
298
+ # Different colors for different enemy types
299
+ if e.is_boss:
300
+ color = COLORS['enemy_boss']
301
+ elif e.elite:
302
+ color = COLORS['enemy_elite']
303
+ else:
304
+ color = COLORS['enemy']
305
+
306
+ pygame.draw.circle(self.screen, color, (int(e.x) + shake_x, int(e.y) + shake_y), e.radius - 1)
307
+
308
+ # Draw Boss crown and health bar
309
+ if e.is_boss:
310
+ pygame.draw.polygon(self.screen, COLORS['gold'], [
311
+ (e.x - 15 + shake_x, e.y - e.radius // 2 + 10 + shake_y),
312
+ (e.x - 8 + shake_x, e.y - e.radius // 2 - 10 + shake_y),
313
+ (e.x + shake_x, e.y - e.radius // 2 + shake_y),
314
+ (e.x + 8 + shake_x, e.y - e.radius // 2 - 10 + shake_y),
315
+ (e.x + 15 + shake_x, e.y - e.radius // 2 + 10 + shake_y)
316
+ ])
317
+ bar_w = 80 * (e.hp / e.max_hp)
318
+ pygame.draw.rect(self.screen, (255, 50, 50), (int(e.x) - 40 + shake_x, int(e.y) - e.radius - 15 + shake_y, 80, 6))
319
+ pygame.draw.rect(self.screen, (0, 255, 0), (int(e.x) - 40 + shake_x, int(e.y) - e.radius - 15 + shake_y, int(bar_w), 6))
320
+
321
+ # Draw Elite white ring
322
+ elif e.elite:
323
+ pygame.draw.circle(self.screen, COLORS['white'], (int(e.x) + shake_x, int(e.y) + shake_y), e.radius - 1, 2)
324
+
325
+ n_b = lib.get_bullet_count()
326
+ if n_b > 0:
327
+ arr_b = (CBullet * n_b)()
328
+ lib.get_bullets(arr_b)
329
+ for b in arr_b:
330
+ # If speed_y > 0, it's a Boss bullet, draw it red
331
+ if b.speed_y > 0:
332
+ pygame.draw.circle(self.screen, (255, 0, 0), (int(b.x) + shake_x, int(b.y) + shake_y), b.radius)
333
+ pygame.draw.circle(self.screen, (255, 255, 255), (int(b.x) + shake_x, int(b.y) + shake_y), b.radius // 2)
334
+ else:
335
+ self.screen.blit(self.bullet_surface, (int(b.x) - 6 + shake_x, int(b.y) - 6 + shake_y))
336
+ for i, (tx, ty) in enumerate(self.player_trail[:-1]):
337
+ alpha = int(150 * (i / len(self.player_trail)))
338
+ surf = pygame.Surface((40, 40), pygame.SRCALPHA)
339
+ pygame.draw.circle(surf, (*COLORS['player_main'][:3], alpha), (20, 20), 16)
340
+ self.screen.blit(surf, (int(tx) - 20 + shake_x, int(ty) - 20 + shake_y))
341
+
342
+ if self.invincible <= 0 or (self.invincible // 5) % 2 == 0:
343
+ self.screen.blit(self.player_surface, (int(self.player_x) - 20 + shake_x, int(self.player_y) - 20 + shake_y))
344
+
345
+ for ex in self.explosions:
346
+ ratio = ex['life'] / ex['max_life']
347
+ pygame.draw.circle(self.screen, (255, 100, 30), (int(ex['x']), int(ex['y'])), int(ex['radius'] * (0.5 + ratio * 0.5)))
348
+ for p in self.particles:
349
+ pygame.draw.circle(self.screen, p['color'], (int(p['x']), int(p['y'])), int(p['size']))
350
+
351
+ # UI Buttons
352
+ pygame.draw.circle(self.screen, (100, 100, 100, 128), (100, HEIGHT - 100), 50)
353
+ pygame.draw.circle(self.screen, (255, 255, 255), (80, HEIGHT - 100), 15)
354
+ pygame.draw.circle(self.screen, (100, 100, 100, 128), (250, HEIGHT - 100), 50)
355
+ pygame.draw.circle(self.screen, (255, 255, 255), (270, HEIGHT - 100), 15)
356
+
357
+ pygame.draw.circle(self.screen, (255, 100, 100, 180), (WIDTH - 120, HEIGHT - 120), 60)
358
+ self.draw_text("FIRE", WIDTH - 120, HEIGHT - 120, COLORS['white'], center=True, font=self.font_medium)
359
+
360
+ if self.nuke_timer <= 0:
361
+ pygame.draw.circle(self.screen, (255, 215, 0, 200), (WIDTH - 300, HEIGHT - 100), 50)
362
+ self.draw_text("NUKE", WIDTH - 300, HEIGHT - 100, (0,0,0), center=True, font=self.font_medium)
363
+ else:
364
+ pygame.draw.circle(self.screen, (100, 100, 100, 100), (WIDTH - 300, HEIGHT - 100), 50)
365
+ cd_sec = math.ceil(self.nuke_timer / 60)
366
+ self.draw_text(f"{cd_sec}s", WIDTH - 300, HEIGHT - 100, COLORS['white'], center=True, font=self.font_medium)
367
+
368
+ self.draw_text(f"Score: {self.score}", 30, 20, COLORS['score'], font=self.font_medium)
369
+ self.draw_text(f"Lives: {self.lives}", WIDTH - 220, 20, COLORS['lives'], font=self.font_medium)
370
+
371
+ if not self.game_active:
372
+ self.draw_text("GAME OVER", WIDTH // 2, HEIGHT // 2 - 30, COLORS['gameover'], center=True, font=self.font_large)
373
+ self.draw_text("Press [ R ] to Restart", WIDTH // 2, HEIGHT // 2 + 20, (187, 221, 255), center=True, font=self.font_small)
374
+ pygame.display.flip()
375
+
376
+ def handle_events(self):
377
+ for event in pygame.event.get():
378
+ if event.type == pygame.QUIT: return False
379
+ elif event.type == pygame.KEYDOWN:
380
+ if event.key in (pygame.K_LEFT, pygame.K_a): self.btn_left = True
381
+ if event.key in (pygame.K_RIGHT, pygame.K_d): self.btn_right = True
382
+ if event.key in (pygame.K_SPACE, pygame.K_UP, pygame.K_k): self.btn_fire = True
383
+ if event.key == pygame.K_r: self.reset_game()
384
+ if event.key == pygame.K_ESCAPE: return False
385
+ elif event.type == pygame.KEYUP:
386
+ if event.key in (pygame.K_LEFT, pygame.K_a): self.btn_left = False
387
+ if event.key in (pygame.K_RIGHT, pygame.K_d): self.btn_right = False
388
+ if event.key in (pygame.K_SPACE, pygame.K_UP, pygame.K_k): self.btn_fire = False
389
+
390
+ elif event.type == pygame.MOUSEBUTTONDOWN:
391
+ mx, my = event.pos
392
+ if math.hypot(mx - 100, my - (HEIGHT - 100)) < 50:
393
+ self.btn_left = True
394
+ elif math.hypot(mx - 250, my - (HEIGHT - 100)) < 50:
395
+ self.btn_right = True
396
+ elif math.hypot(mx - (WIDTH - 120), my - (HEIGHT - 120)) < 60:
397
+ self.btn_fire = True
398
+ elif math.hypot(mx - (WIDTH - 300), my - (HEIGHT - 100)) < 50 and self.nuke_timer <= 0:
399
+ # Nuke triggered: 50 vertical bullets
400
+ self.nuke_timer = NUKE_COOLDOWN
401
+ self.flash_timer = 15
402
+ self.screen_shake = 20
403
+ self.sfx_boom.play()
404
+ self.screen.fill((255, 255, 255))
405
+
406
+ # Fire 50 vertical bullets across the screen
407
+ for i in range(50):
408
+ spawn_x = 50 + i * ((WIDTH - 100) / 49)
409
+ lib.add_bullet(float(spawn_x), float(self.player_y), 0.0, float(BULLET_SPEED * 1.2), 6, 2)
410
+
411
+ elif event.type == pygame.MOUSEBUTTONUP:
412
+ self.btn_left = False
413
+ self.btn_right = False
414
+ self.btn_fire = False
415
+ return True
416
+
417
+ def draw_text(self, text, x, y, color, center=False, font=None):
418
+ if font is None: font = self.font_medium
419
+ surface = self.render_text(text, font, color)
420
+ rect = surface.get_rect()
421
+ if center: rect.center = (x, y)
422
+ else: rect.topleft = (x, y)
423
+ self.screen.blit(surface, rect)
424
+
425
+ def run(self):
426
+ while True:
427
+ if not self.handle_events(): break
428
+ self.update()
429
+ self.draw()
430
+ self.clock.tick(FPS)
431
+ pygame.quit()
432
+ sys.exit()
433
+
434
+ if __name__ == "__main__":
435
+ game = StarGuardian()
436
+ game.run()
ed_game/game_2.py ADDED
@@ -0,0 +1,442 @@
1
+ import pygame
2
+ import random
3
+ import math
4
+ import sys
5
+ import array
6
+
7
+ WIDTH = 1800
8
+ HEIGHT = 1050
9
+ FPS = 60
10
+
11
+ COLORS = {
12
+ 'bg': (2, 6, 23), 'enemy': (255, 58, 111), 'enemy_elite': (255, 136, 68),
13
+ 'enemy_boss': (180, 50, 255), 'bullet': (255, 255, 128), 'bullet_core': (255, 204, 68),
14
+ 'player_main': (62, 255, 250), 'player_core': (0, 204, 255), 'player_fire': (255, 102, 0),
15
+ 'score': (0, 255, 255), 'lives': (255, 51, 102), 'status': (255, 215, 0),
16
+ 'gameover': (255, 68, 102), 'white': (255, 255, 255), 'gold': (255, 215, 0), 'heart': (255, 80, 120),
17
+ }
18
+
19
+ BASE_ENEMY_SPEED = 0.31
20
+ MAX_ENEMY_SPEED = 0.85
21
+ ELITE_SPEED_FACTOR = 0.84
22
+ BOSS_SPEED_FACTOR = 0.2
23
+ BULLET_SPEED = -8.5
24
+ PLAYER_SPEED = 6.2
25
+ PLAYER_RADIUS = 15
26
+ INVINCIBLE_DURATION = 55
27
+ SHOOT_COOLDOWN_FRAMES = 9
28
+ BASE_SPAWN_DELAY = 48
29
+ STAR_COUNT = 220
30
+ BOSS_SIZE_MULTIPLIER = 4
31
+ BOSS_SPAWN_INTERVAL = 20 * 1000
32
+ NUKE_COOLDOWN = 7.2 * 1000
33
+
34
+ def generate_sound(frequency, duration, volume=0.5, type='square'):
35
+ sample_rate = 22050
36
+ n_samples = int(sample_rate * duration)
37
+ buf = array.array('h', [0] * n_samples)
38
+ for i in range(n_samples):
39
+ t = float(i) / sample_rate
40
+ if type == 'square':
41
+ val = 1.0 if math.sin(2 * math.pi * frequency * t) > 0 else -1.0
42
+ else:
43
+ val = math.sin(2 * math.pi * frequency * t)
44
+ envelope = max(0.0, 1.0 - (i / n_samples))
45
+ buf[i] = int(val * volume * envelope * 32767)
46
+ return pygame.mixer.Sound(buffer=buf.tobytes())
47
+
48
+ class StarGuardian:
49
+ def __init__(self, speed_multiplier=1.0):
50
+ pygame.init()
51
+ pygame.mixer.init(frequency=22050, size=-16, channels=1)
52
+
53
+ self.screen = pygame.display.set_mode((WIDTH, HEIGHT))
54
+ pygame.display.set_caption("Star Guardian 3.1.0 · Mobile & PC")
55
+ self.clock = pygame.time.Clock()
56
+ self.speed_multiplier = speed_multiplier
57
+
58
+ self.sfx_shoot = generate_sound(800, 0.05, 0.3, 'square')
59
+ self.sfx_boom = generate_sound(100, 0.3, 0.6, 'sine')
60
+
61
+ self.bullet_surface = pygame.Surface((12, 12), pygame.SRCALPHA)
62
+ pygame.draw.circle(self.bullet_surface, COLORS['bullet'], (6, 6), 5)
63
+ pygame.draw.circle(self.bullet_surface, COLORS['bullet_core'], (6, 6), 3)
64
+
65
+ self.player_surface = pygame.Surface((40, 40), pygame.SRCALPHA)
66
+ pygame.draw.circle(self.player_surface, COLORS['player_main'], (20, 20), 16)
67
+ pygame.draw.circle(self.player_surface, COLORS['player_core'], (20, 16), 6)
68
+ pygame.draw.circle(self.player_surface, COLORS['white'], (17, 14), 2)
69
+ pygame.draw.circle(self.player_surface, COLORS['white'], (23, 14), 2)
70
+ pygame.draw.circle(self.player_surface, COLORS['player_fire'], (20, 38), 6)
71
+ pygame.draw.circle(self.player_surface, COLORS['player_fire'], (17, 36), 4)
72
+ pygame.draw.circle(self.player_surface, COLORS['player_fire'], (23, 36), 4)
73
+
74
+ self.stars = []
75
+ for _ in range(250):
76
+ self.stars.append({
77
+ 'x': random.randint(0, WIDTH),
78
+ 'y': random.randint(0, HEIGHT),
79
+ 'radius': random.uniform(1.0, 2.5)
80
+ })
81
+ self.stars = []
82
+ for _ in range(250):
83
+ self.stars.append({
84
+ 'x': random.randint(0, WIDTH),
85
+ 'y': random.randint(0, HEIGHT),
86
+ 'radius': random.uniform(1.0, 2.5)
87
+ })
88
+
89
+ self._load_fonts()
90
+ self.high_score = 0
91
+ self.reset_game()
92
+
93
+ def _load_fonts(self):
94
+ self.font_large = pygame.font.SysFont("arial", 48, bold=True)
95
+ self.font_medium = pygame.font.SysFont("arial", 28, bold=True)
96
+ self.font_small = pygame.font.SysFont("arial", 20)
97
+ self.font_tiny = pygame.font.SysFont("arial", 14)
98
+ self._text_cache = {}
99
+
100
+ def render_text(self, text, font, color):
101
+ key = (text, id(font), color)
102
+ if key not in self._text_cache:
103
+ self._text_cache[key] = font.render(text, True, color)
104
+ return self._text_cache[key]
105
+
106
+ def reset_game(self):
107
+ if hasattr(self, 'score'):
108
+ self.high_score = max(self.high_score, self.score)
109
+
110
+ self.game_active = True
111
+ self.score = 0
112
+ self.wave_level = 1
113
+ self.lives = 3
114
+ self.invincible = 0
115
+ self.player_x = WIDTH // 2
116
+ self.player_y = HEIGHT - 60
117
+ self.shoot_cooldown = 0
118
+ self.nuke_timer = 0
119
+ self.screen_shake = 0
120
+ self.flash_timer = 0
121
+ self.enemies = []
122
+ self.bullets = []
123
+ self.enemy_bullets = []
124
+ self.explosions = []
125
+ self.particles = []
126
+ self.player_trail = []
127
+ self.enemy_spawn_timer = 20
128
+ self.spawn_delay_current = BASE_SPAWN_DELAY
129
+ self.last_boss_spawn_time = pygame.time.get_ticks()
130
+
131
+ self.btn_left = False
132
+ self.btn_right = False
133
+ self.btn_fire = False
134
+
135
+ for _ in range(3): self.spawn_enemy()
136
+
137
+ def spawn_enemy(self, is_boss=False):
138
+ if is_boss:
139
+ radius = 12 * BOSS_SIZE_MULTIPLIER
140
+ x = random.randint(radius, WIDTH - radius)
141
+ speed = 0.06 * self.speed_multiplier
142
+ hp = 50
143
+
144
+ self.enemies.append({
145
+ 'x': x, 'y': -radius, 'radius': radius,
146
+ 'speed_y': speed, 'color': COLORS['enemy_boss'],
147
+ 'hp': hp, 'max_hp': hp, 'score_value': 200,
148
+ 'elite': False, 'is_boss': True
149
+ })
150
+ self.status_message = "⚠️ Giant Overlord Descends! ⚠️"
151
+ self.status_msg_timer = 90
152
+ else:
153
+ radius = 12
154
+ x = random.randint(radius, WIDTH - radius)
155
+ speed = 0.31 * self.speed_multiplier
156
+ hp = 1
157
+ score_val = 10
158
+ is_elite = False
159
+
160
+ # 18% chance to spawn an elite
161
+ if self.wave_level >= 2 and random.random() < 0.18:
162
+ radius = 16
163
+ hp = 2
164
+ score_val = 30
165
+ speed *= 0.84
166
+ is_elite = True
167
+
168
+ color = COLORS['enemy_elite'] if is_elite else COLORS['enemy']
169
+
170
+ self.enemies.append({
171
+ 'x': x, 'y': -radius, 'radius': radius,
172
+ 'speed_y': speed, 'color': color,
173
+ 'hp': hp, 'max_hp': hp, 'score_value': score_val,
174
+ 'elite': is_elite, 'is_boss': False
175
+ })
176
+
177
+ def add_explosion(self, px, py, is_boss=False):
178
+ self.explosions.append({'x': px, 'y': py, 'life': 6 if not is_boss else 20, 'max_life': 6 if not is_boss else 20, 'radius': 12 if not is_boss else 30})
179
+ for _ in range(8 if not is_boss else 30):
180
+ self.particles.append({'x': px, 'y': py, 'vx': (random.random() - 0.5) * 3.5, 'vy': (random.random() - 0.5) * 3 - 1, 'life': 6 if not is_boss else 20, 'size': random.random() * 3 + 1.5, 'color': (255, random.randint(100, 255), 50)})
181
+
182
+ def update(self):
183
+ if not self.game_active: return
184
+ if self.invincible > 0: self.invincible -= 1
185
+ if self.shoot_cooldown > 0: self.shoot_cooldown -= 1
186
+ if self.nuke_timer > 0: self.nuke_timer -= 1
187
+
188
+ if self.btn_left: self.player_x -= PLAYER_SPEED
189
+ if self.btn_right: self.player_x += PLAYER_SPEED
190
+ self.player_x = max(PLAYER_RADIUS + 5, min(WIDTH - PLAYER_RADIUS - 5, self.player_x))
191
+
192
+ if self.btn_fire and self.shoot_cooldown == 0:
193
+ self.bullets.append({'x': self.player_x, 'y': self.player_y - 12, 'radius': 5, 'speed_y': BULLET_SPEED, 'damage': 1})
194
+ self.sfx_shoot.play()
195
+ self.shoot_cooldown = SHOOT_COOLDOWN_FRAMES
196
+
197
+ # BOSS Spawn Timer
198
+ current_time = pygame.time.get_ticks()
199
+ if current_time - self.last_boss_spawn_time >= BOSS_SPAWN_INTERVAL:
200
+ self.last_boss_spawn_time = current_time
201
+ self.spawn_enemy(is_boss=True)
202
+ self.status_message = "👑 Giant Overlord Arrives! 👑"
203
+ self.status_msg_timer = 180
204
+
205
+ for b in self.bullets[:]:
206
+ b['y'] += b['speed_y']
207
+ if b['y'] + b['radius'] < 0: self.bullets.remove(b)
208
+
209
+ for e in self.enemies[:]:
210
+ e['y'] += e['speed_y']
211
+ if e['y'] > HEIGHT + 40: self.enemies.remove(e)
212
+
213
+ for b in self.bullets[:]:
214
+ hit = None
215
+ for e in self.enemies:
216
+ if math.hypot(b['x'] - e['x'], b['y'] - e['y']) < b['radius'] + e['radius']:
217
+ hit = e
218
+ break
219
+ if hit:
220
+ self.bullets.remove(b)
221
+ hit['hp'] -= b['damage']
222
+ if hit['hp'] <= 0:
223
+ self.score += hit['score_value']
224
+
225
+ # Update wave level for elite spawns
226
+ raw_wave = min(1 + self.score // 550, 9)
227
+ if raw_wave > self.wave_level:
228
+ self.wave_level = raw_wave
229
+ self.spawn_delay_current = max(20, 48 - int(self.wave_level * 2))
230
+
231
+ self.add_explosion(hit['x'], hit['y'], is_boss=hit['is_boss'])
232
+ self.sfx_boom.play()
233
+ self.enemies.remove(hit)
234
+
235
+ for e in self.enemies[:]:
236
+ if math.hypot(self.player_x - e['x'], self.player_y - e['y']) < PLAYER_RADIUS + e['radius']:
237
+ if self.invincible <= 0 and self.game_active:
238
+ self.lives -= 1
239
+ self.screen_shake = 15
240
+ if self.lives <= 0:
241
+ self.lives = 0
242
+ self.game_active = False
243
+ return
244
+ else:
245
+ self.invincible = INVINCIBLE_DURATION
246
+ self.add_explosion(self.player_x, self.player_y)
247
+ self.enemies.remove(e)
248
+ if getattr(self, 'boss_fire_timer', 0) > 0:
249
+ self.boss_fire_timer -= 1
250
+ else:
251
+ for e in self.enemies:
252
+ if e.get('is_boss'):
253
+ self.enemy_bullets.append({'x': e['x'], 'y': e['y'] + e['radius'], 'speed_y': 5.0, 'radius': 8})
254
+ self.boss_fire_timer = 180
255
+
256
+
257
+ for eb in self.enemy_bullets[:]:
258
+ eb['y'] += eb['speed_y']
259
+ if eb['y'] > HEIGHT:
260
+ self.enemy_bullets.remove(eb)
261
+ continue
262
+ if math.hypot(self.player_x - eb['x'], self.player_y - eb['y']) < PLAYER_RADIUS + eb['radius']:
263
+ self.enemy_bullets.remove(eb)
264
+ if self.invincible <= 0:
265
+ self.lives -= 1
266
+ self.screen_shake = 15
267
+ if self.lives <= 0:
268
+ self.lives = 0
269
+ self.game_active = False
270
+ return
271
+ else:
272
+ self.invincible = INVINCIBLE_DURATION
273
+
274
+ self.enemy_spawn_timer -= 1
275
+ if self.enemy_spawn_timer <= 0:
276
+ self.spawn_enemy()
277
+ self.enemy_spawn_timer = self.spawn_delay_current
278
+
279
+ for p in self.particles[:]:
280
+ p['x'] += p['vx']
281
+ p['y'] += p['vy']
282
+ p['life'] -= 1
283
+ if p['life'] <= 0: self.particles.remove(p)
284
+ for ex in self.explosions[:]:
285
+ ex['life'] -= 1
286
+ if ex['life'] <= 0: self.explosions.remove(ex)
287
+
288
+ self.player_trail.append((self.player_x, self.player_y))
289
+ if len(self.player_trail) > 6: self.player_trail.pop(0)
290
+
291
+ def draw(self):
292
+ shake_x = random.randint(-8, 8) if self.screen_shake > 0 else 0
293
+ shake_y = random.randint(-8, 8) if self.screen_shake > 0 else 0
294
+ if self.screen_shake > 0: self.screen_shake -= 1
295
+
296
+ self.screen.fill(COLORS['bg'])
297
+
298
+ for star in self.stars:
299
+ pygame.draw.circle(self.screen, (255, 240, 200), (int(star['x']), int(star['y'])), int(star['radius']))
300
+
301
+ for e in self.enemies:
302
+ if e.get('is_boss'):
303
+ color = COLORS['enemy_boss']
304
+ elif e.get('elite'):
305
+ color = COLORS['enemy_elite']
306
+ else:
307
+ color = COLORS['enemy']
308
+
309
+ pygame.draw.circle(self.screen, color, (int(e['x']) + shake_x, int(e['y']) + shake_y), e['radius'] - 1)
310
+
311
+ # Draw Boss crown and health bar
312
+ if e.get('is_boss'):
313
+ pygame.draw.polygon(self.screen, COLORS['gold'], [
314
+ (e['x'] - 15 + shake_x, e['y'] - e['radius'] // 2 + 10 + shake_y),
315
+ (e['x'] - 8 + shake_x, e['y'] - e['radius'] // 2 - 10 + shake_y),
316
+ (e['x'] + shake_x, e['y'] - e['radius'] // 2 + shake_y),
317
+ (e['x'] + 8 + shake_x, e['y'] - e['radius'] // 2 - 10 + shake_y),
318
+ (e['x'] + 15 + shake_x, e['y'] - e['radius'] // 2 + 10 + shake_y)
319
+ ])
320
+ bar_w = 80 * (e['hp'] / e['max_hp'])
321
+ pygame.draw.rect(self.screen, (255, 50, 50), (int(e['x']) - 40 + shake_x, int(e['y']) - e['radius'] - 15 + shake_y, 80, 6))
322
+ pygame.draw.rect(self.screen, (0, 255, 0), (int(e['x']) - 40 + shake_x, int(e['y']) - e['radius'] - 15 + shake_y, int(bar_w), 6))
323
+
324
+ # Draw Elite white ring
325
+ elif e.get('elite'):
326
+ pygame.draw.circle(self.screen, COLORS['white'], (int(e['x']) + shake_x, int(e['y']) + shake_y), e['radius'] - 1, 2)
327
+
328
+ for b in self.bullets:
329
+ self.screen.blit(self.bullet_surface, (int(b['x']) - 6 + shake_x, int(b['y']) - 6 + shake_y))
330
+
331
+ for eb in self.enemy_bullets:
332
+ pygame.draw.circle(self.screen, (255, 0, 0), (int(eb['x']) + shake_x, int(eb['y']) + shake_y), eb['radius'])
333
+ pygame.draw.circle(self.screen, (255, 255, 255), (int(eb['x']) + shake_x, int(eb['y']) + shake_y), eb['radius'] // 2)
334
+
335
+ for i, (tx, ty) in enumerate(self.player_trail[:-1]):
336
+ alpha = int(150 * (i / len(self.player_trail)))
337
+ surf = pygame.Surface((40, 40), pygame.SRCALPHA)
338
+ pygame.draw.circle(surf, (*COLORS['player_main'][:3], alpha), (20, 20), 16)
339
+ self.screen.blit(surf, (int(tx) - 20 + shake_x, int(ty) - 20 + shake_y))
340
+
341
+ if self.invincible <= 0 or (self.invincible // 5) % 2 == 0:
342
+ self.screen.blit(self.player_surface, (int(self.player_x) - 20 + shake_x, int(self.player_y) - 20 + shake_y))
343
+
344
+ for ex in self.explosions:
345
+ ratio = ex['life'] / ex['max_life']
346
+ pygame.draw.circle(self.screen, (255, 100, 30), (int(ex['x']), int(ex['y'])), int(ex['radius'] * (0.5 + ratio * 0.5)))
347
+ for p in self.particles:
348
+ pygame.draw.circle(self.screen, p['color'], (int(p['x']), int(p['y'])), int(p['size']))
349
+
350
+ # UI Buttons
351
+ pygame.draw.circle(self.screen, (100, 100, 100, 128), (100, HEIGHT - 100), 50)
352
+ pygame.draw.circle(self.screen, (255, 255, 255), (80, HEIGHT - 100), 15)
353
+ pygame.draw.circle(self.screen, (100, 100, 100, 128), (250, HEIGHT - 100), 50)
354
+ pygame.draw.circle(self.screen, (255, 255, 255), (270, HEIGHT - 100), 15)
355
+
356
+ pygame.draw.circle(self.screen, (255, 100, 100, 180), (WIDTH - 120, HEIGHT - 120), 60)
357
+ self.draw_text("FIRE", WIDTH - 120, HEIGHT - 120, COLORS['white'], center=True, font=self.font_medium)
358
+
359
+ if self.nuke_timer <= 0:
360
+ pygame.draw.circle(self.screen, (255, 215, 0, 200), (WIDTH - 300, HEIGHT - 100), 50)
361
+ self.draw_text("NUKE", WIDTH - 300, HEIGHT - 100, (0,0,0), center=True, font=self.font_medium)
362
+ else:
363
+ pygame.draw.circle(self.screen, (100, 100, 100, 100), (WIDTH - 300, HEIGHT - 100), 50)
364
+ cd_sec = math.ceil(self.nuke_timer / 60)
365
+ self.draw_text(f"{cd_sec}s", WIDTH - 300, HEIGHT - 100, COLORS['white'], center=True, font=self.font_medium)
366
+
367
+ self.draw_text(f"Score: {self.score}", 30, 20, COLORS['score'], font=self.font_medium)
368
+ self.draw_text(f"Lives: {self.lives}", WIDTH - 220, 20, COLORS['lives'], font=self.font_medium)
369
+
370
+ if not self.game_active:
371
+ self.draw_text("GAME OVER", WIDTH // 2, HEIGHT // 2 - 30, COLORS['gameover'], center=True, font=self.font_large)
372
+ self.draw_text("Press [ R ] to Restart", WIDTH // 2, HEIGHT // 2 + 20, (187, 221, 255), center=True, font=self.font_small)
373
+
374
+ # The most important line!
375
+ pygame.display.flip()
376
+
377
+ def draw_text(self, text, x, y, color, center=False, font=None):
378
+ if font is None: font = self.font_medium
379
+ surface = self.render_text(text, font, color)
380
+ rect = surface.get_rect()
381
+ if center: rect.center = (x, y)
382
+ else: rect.topleft = (x, y)
383
+ self.screen.blit(surface, rect)
384
+
385
+ def handle_events(self):
386
+ for event in pygame.event.get():
387
+ if event.type == pygame.QUIT: return False
388
+ elif event.type == pygame.KEYDOWN:
389
+ if event.key in (pygame.K_LEFT, pygame.K_a): self.btn_left = True
390
+ if event.key in (pygame.K_RIGHT, pygame.K_d): self.btn_right = True
391
+ if event.key in (pygame.K_SPACE, pygame.K_UP, pygame.K_k): self.btn_fire = True
392
+ if event.key == pygame.K_r: self.reset_game()
393
+ if event.key == pygame.K_ESCAPE: return False
394
+ elif event.type == pygame.KEYUP:
395
+ if event.key in (pygame.K_LEFT, pygame.K_a): self.btn_left = False
396
+ if event.key in (pygame.K_RIGHT, pygame.K_d): self.btn_right = False
397
+ if event.key in (pygame.K_SPACE, pygame.K_UP, pygame.K_k): self.btn_fire = False
398
+
399
+ elif event.type == pygame.MOUSEBUTTONDOWN:
400
+ mx, my = event.pos
401
+ if math.hypot(mx - 100, my - (HEIGHT - 100)) < 50:
402
+ self.btn_left = True
403
+ elif math.hypot(mx - 250, my - (HEIGHT - 100)) < 50:
404
+ self.btn_right = True
405
+ elif math.hypot(mx - (WIDTH - 120), my - (HEIGHT - 120)) < 60:
406
+ self.btn_fire = True
407
+ elif math.hypot(mx - (WIDTH - 300), my - (HEIGHT - 100)) < 50 and self.nuke_timer <= 0:
408
+ # Nuke triggered: 50 vertical bullets
409
+ self.nuke_timer = NUKE_COOLDOWN
410
+ self.flash_timer = 15
411
+ self.screen_shake = 20
412
+ self.sfx_boom.play()
413
+ self.screen.fill((255, 255, 255))
414
+
415
+ # Fire 50 vertical bullets across the screen
416
+ for i in range(50):
417
+ spawn_x = 50 + i * ((WIDTH - 100) / 49)
418
+ self.bullets.append({
419
+ 'x': spawn_x,
420
+ 'y': self.player_y,
421
+ 'radius': 6,
422
+ 'speed_y': BULLET_SPEED * 1.2,
423
+ 'damage': 2
424
+ })
425
+
426
+ elif event.type == pygame.MOUSEBUTTONUP:
427
+ self.btn_left = False
428
+ self.btn_right = False
429
+ self.btn_fire = False
430
+ return True
431
+ def run(self):
432
+ while True:
433
+ if not self.handle_events(): break
434
+ self.update()
435
+ self.draw()
436
+ self.clock.tick(FPS)
437
+ pygame.quit()
438
+ sys.exit()
439
+
440
+ if __name__ == "__main__":
441
+ game = StarGuardian()
442
+ game.run()
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.4
2
+ Name: ed-game
3
+ Version: 5.0.0
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 (with optional pure Python fallback).
56
+ - **Other platforms:** runs on a 100% pure-Python fallback.
57
+
58
+ ### 🆕 What's New in 5.0.0
59
+ - **Pygame Returns**: Abandoned the buggy Pyglet (4.x) experiment and fully restored the rock-solid Pygame engine.
60
+ - **Dynamic Mode Selection**: Windows users now get a CLI prompt to choose between the C++ accelerated mode or the Pure Python fallback mode on startup.
61
+ - **Platform Optimization**: Separate wheels for Windows (with DLL) and Mac/Linux (pure Python) to ensure maximum compatibility and minimal package size.
@@ -0,0 +1,9 @@
1
+ ed_game/__init__.py,sha256=yTDaLwIIYIMxtBwcfkSimG4VqtrNUelagom2ZbQbhw0,1144
2
+ ed_game/edgame_core.dll,sha256=_EFz3mmdiTDh8gFVUjBCgsGzrmaaAzmcQI8qlWNcg38,710912
3
+ ed_game/game_1.py,sha256=fvugGCHK-KX33uKP_cFPfcEb-O98A_0Ir6MjDP_Sq6Q,20577
4
+ ed_game/game_2.py,sha256=l4zwaikI0D2adCejkV3VMSldzgYjfMAFE2DU8O8p8jM,20112
5
+ ed_game-5.0.0.dist-info/licenses/LICENSE,sha256=O0aOzFOF44nCP9nvtF4-d3zvr6i03_XqHQNeYzZEy0M,1068
6
+ ed_game-5.0.0.dist-info/METADATA,sha256=yz_cJJ8LRq3EwCYKJT6pNdodSJmKerH4IUvfzF01o9s,2275
7
+ ed_game-5.0.0.dist-info/WHEEL,sha256=bhMFZwp6VMtrbl2Ck6PlXryKaCggO1NzYn_HcFbBF1I,97
8
+ ed_game-5.0.0.dist-info/top_level.txt,sha256=4WJ_IFeiEbATUhENEEoQE1_xHIIWhYnaq-jmMuAWUYw,8
9
+ ed_game-5.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-win_amd64
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 qq-name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ ed_game