commit 1e38fb37d1e3ca39b75307d0b09fe195d48fa23b Author: Itsig0 Date: Wed Mar 5 12:42:17 2025 +0100 The fist step. A new window appeared. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..93526df --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +venv/ +__pycache__/ diff --git a/constants.py b/constants.py new file mode 100644 index 0000000..48312a2 --- /dev/null +++ b/constants.py @@ -0,0 +1,7 @@ +SCREEN_WIDTH = 1280 +SCREEN_HEIGHT = 720 + +ASTEROID_MIN_RADIUS = 20 +ASTEROID_KINDS = 3 +ASTEROID_SPAWN_RATE = 0.8 # seconds +ASTEROID_MAX_RADIUS = ASTEROID_MIN_RADIUS * ASTEROID_KINDS diff --git a/main.py b/main.py new file mode 100644 index 0000000..51c48a5 --- /dev/null +++ b/main.py @@ -0,0 +1,25 @@ +# this allows us to use code from +# the open-source pygame library +# throughout this file +import pygame +from constants import * + +def main(): + print("Starting Asteroids!") + print(f"Screen width: {SCREEN_WIDTH}") + print(f"Screen height: {SCREEN_HEIGHT}") + pygame.init() + + #set screen resolution + screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) + + while True: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + return + + screen.fill((0,0,0)) + pygame.display.flip() + +if __name__ == "__main__": + main() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5873083 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pygame==2.6.1