From 579bf22ff5c0662cafe9fde4bcd87a77ed3f753b Mon Sep 17 00:00:00 2001 From: CodeLongAndProsper90 <50145141+CodeLongAndProsper90@users.noreply.github.com> Date: Tue, 14 Jan 2020 13:47:29 -0600 Subject: [PATCH 1/3] Create constants.py --- spaceshooter/constants.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 spaceshooter/constants.py diff --git a/spaceshooter/constants.py b/spaceshooter/constants.py new file mode 100644 index 0000000..53d5071 --- /dev/null +++ b/spaceshooter/constants.py @@ -0,0 +1,14 @@ +WIDTH = 480 +HEIGHT = 600 +FPS = 60 +POWERUP_TIME = 5000 +BAR_LENGTH = 100 +BAR_HEIGHT = 10 + +# Define Colors +WHITE = (255, 255, 255) +BLACK = (0, 0, 0) +RED = (255, 0, 0) +GREEN = (0, 255, 0) +BLUE = (0, 0, 255) +YELLOW = (255, 255, 0) From 9020710b68a19bded12bb3c8c327131338dd9861 Mon Sep 17 00:00:00 2001 From: CodeLongAndProsper90 <50145141+CodeLongAndProsper90@users.noreply.github.com> Date: Tue, 14 Jan 2020 13:49:20 -0600 Subject: [PATCH 2/3] Update spaceShooter.py --- spaceshooter/spaceShooter.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/spaceshooter/spaceShooter.py b/spaceshooter/spaceShooter.py index 2a3fae2..5e37ae3 100644 --- a/spaceshooter/spaceShooter.py +++ b/spaceshooter/spaceShooter.py @@ -19,28 +19,8 @@ import pygame import random from os import path +from constans import * -## assets folder -img_dir = path.join(path.dirname(__file__), 'assets') -sound_folder = path.join(path.dirname(__file__), 'sounds') - -############################### -## to be placed in "constant.py" later -WIDTH = 480 -HEIGHT = 600 -FPS = 60 -POWERUP_TIME = 5000 -BAR_LENGTH = 100 -BAR_HEIGHT = 10 - -# Define Colors -WHITE = (255, 255, 255) -BLACK = (0, 0, 0) -RED = (255, 0, 0) -GREEN = (0, 255, 0) -BLUE = (0, 0, 255) -YELLOW = (255, 255, 0) -############################### ############################### ## to placed in "__init__.py" later From 4a3ced3a306c3522281e97ef12dc7e4068583f85 Mon Sep 17 00:00:00 2001 From: CodeLongAndProsper90 <50145141+CodeLongAndProsper90@users.noreply.github.com> Date: Tue, 14 Jan 2020 13:51:37 -0600 Subject: [PATCH 3/3] Create __init.py__ --- spaceshooter/__init.py__ | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 spaceshooter/__init.py__ diff --git a/spaceshooter/__init.py__ b/spaceshooter/__init.py__ new file mode 100644 index 0000000..aee3fa6 --- /dev/null +++ b/spaceshooter/__init.py__ @@ -0,0 +1,6 @@ +## initialize pygame and create window +pygame.init() +pygame.mixer.init() ## For sound +screen = pygame.display.set_mode((WIDTH, HEIGHT)) +pygame.display.set_caption("Space Shooter") +clock = pygame.time.Clock() ## For syncing the FPS