8000 very cool! · Gazman-Dev/space-bugs@35a3bf7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 35a3bf7

Browse files
author
Ilya Gazman
committed
very cool!
1 parent 8bef485 commit 35a3bf7

File tree

4 files changed

+6
-107
lines changed

4 files changed

+6
-107
lines changed

game/game.py

Lines changed: 0 additions & 70 deletions
This file was deleted.

game/game.py.bul

Lines changed: 0 additions & 34 deletions
This file was deleted.

game/game_logic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(self) -> None:
1515
pygame.init()
1616
self.screen: pygame.Surface = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
1717
self.clock: pygame.time.Clock = pygame.time.Clock()
18-
self.player: Player = None
18+
self.player: Player | None = None
1919
self.enemies: list[Enemy] = []
2020
self.bullets: list[Bullet] = []
2121
self.running: bool = True
@@ -45,7 +45,7 @@ def game_loop(self) -> None:
4545
self.draw()
4646
self.clock.tick(FPS)
4747
self.spawn_enemies()
48-
self.toolbar.update(self.player_health, self.score) # Update toolbar with live stats
48+
self.toolbar.update(self.score, self.player_health) # Update toolbar with live stats
4949

5050
def check_collisions(self) -> None:
5151
bullets_to_remove = []
@@ -57,7 +57,7 @@ def check_collisions(self) -> None:
5757
enemies_to_remove.append(enemy)
5858
bullets_to_remove.append(bullet)
5959
# Increase score on hitting an enemy
60-
self.score += enemy.value
60+
self.score += 1
6161

6262
# Remove bullets and enemies after iteration to avoid modifying the list during iteration
6363
for bullet in bullets_to_remove:

game/toolbar.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import pygame
22

3+
34
class Toolbar:
45
def __init__(self):
56
self.font = pygame.font.Font(pygame.font.get_default_font(), 20)
67
self.score_position = pygame.Vector2(10, 10) # Default position for displaying score
78
self.health_position = pygame.Vector2(10, 40) # Default position for displaying health
9+
self.current_score = -1
10+
self.current_health = -1
811

912
def update(self, score: int, health: int):
1013
# This would typically update internal state if needed

0 commit comments

Comments
 (0)
0