diff --git a/.gitignore b/.gitignore index 4399e9a..9a9e8b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /resources/images/img_resources -*.pyc \ No newline at end of file +*.pyc +*.psd \ No newline at end of file diff --git a/alien.py b/alien.py index 4858bff..e88ba7a 100644 --- a/alien.py +++ b/alien.py @@ -31,6 +31,7 @@ def check_edges(self): screen_rect = self.screen.get_rect() if self.rect.right >= screen_rect.right: return True + elif self.rect.left <= 0: return True diff --git a/alien_invasion.py b/alien_invasion.py index e2b55cc..0748712 100644 --- a/alien_invasion.py +++ b/alien_invasion.py @@ -19,6 +19,7 @@ def run_game(): screen = pygame.display.set_mode( (ai_settings.screen_width, ai_settings.screen_height)) pygame.display.set_caption('Alien Invasion') + sb = Scoreboard(ai_settings, screen, stats) # Make the Play button menu = Menu(ai_settings, screen, stats) diff --git a/bullet.py b/bullet.py index 8fe9c91..db1c5d4 100644 --- a/bullet.py +++ b/bullet.py @@ -26,6 +26,7 @@ def update(self): """ Move the bullet up the screen. """ # Update the decimal value of the bullet self.y -= self.speed_factor + # Update the rect position self.rect.y = self.y diff --git a/button.py b/button.py index 14c927d..0f91886 100644 --- a/button.py +++ b/button.py @@ -32,7 +32,6 @@ def prep_text(self, stats): def prep_msg(self, stats): """ Turn msg into a rendered image and center text on the button. """ - self.prep_text(stats) self.msg_image = self.font.render(self.msg, True, self.text_color, self.button_color) diff --git a/game_functions.py b/game_functions.py index 098dcd7..33d3147 100644 --- a/game_functions.py +++ b/game_functions.py @@ -82,7 +82,6 @@ def start_new_game(ai_settings, screen, stats, sb, ship, bullets, aliens): sb.prep_images() stats.game_active = True stats.game_ended = False - # Empty the list of aliens and bullets aliens.empty() bullets.empty() # Create a new fleet and center the ship @@ -321,7 +320,6 @@ def ship_hit(ai_settings, stats, sb, menu, screen, ship, aliens, bullets): # Create a new fleet and center the ship create_fleet(ai_settings, screen, ship, aliens) ship.center_ship() - # Pause sleep(0.5) else: stats.game_active = False diff --git a/game_stats.py b/game_stats.py index 127b45f..9cadea5 100644 --- a/game_stats.py +++ b/game_stats.py @@ -34,6 +34,7 @@ def get_high_score(self): except FileNotFoundError: high_score = 0 return int(high_score) + else: high_score = 0 return int(high_score) diff --git a/menu.py b/menu.py index a79401f..6f387a9 100644 --- a/menu.py +++ b/menu.py @@ -35,7 +35,6 @@ def prep_text(self, stats): def prep_msg(self, stats): """ Turn the message into a rendered image. """ - self.prep_text(stats) self.msg_image = self.font.render( self.msg, True, self.text_color, self.bg_color) diff --git a/readme.md b/readme.md index a4bbf6c..f5655e2 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,8 @@ # My Own Version of Alien Invasion by: Eric Matthes. -- In this game you have to shoot down aliens before they reach the bottom of the screen. -- There are 3 different aliens green, blue and red. -- Green aliens reward you with 100 points, blue aliens with 150 points and red aliens reward you with 200 points. -- When the the player eliminates all the aliens on the screen a new fleet of aliens is created. -- Every new level increased the tempo of the game and the amount of score rewarded by each alien. + +- In this game you have to shoot down aliens before they reach the bottom of the screen. +- There are 3 different aliens green, blue and red. +- Green aliens reward you with 100 points, blue aliens with 150 points and red aliens reward you with 200 points. +- When the the player eliminates all the aliens on the screen a new fleet of aliens is created. +- Every new level increased the tempo of the game and the amount of score rewarded by each alien. +- Enjoy and learn something new! diff --git a/resources/colors/color_schema.txt b/resources/colors/color_schema.txt index c9cfc29..a981105 100644 --- a/resources/colors/color_schema.txt +++ b/resources/colors/color_schema.txt @@ -1,4 +1,4 @@ --- Color Schema -- +--- Color Schema --- 1. Black: (20, 20, 20) 2. Menu: (45, 53, 89) 3. score/txt: (226, 188, 0) diff --git a/scoreboard.py b/scoreboard.py index a1a8d65..934aa00 100644 --- a/scoreboard.py +++ b/scoreboard.py @@ -9,6 +9,7 @@ class Scoreboard(): def __init__(self, ai_settings, screen, stats): """ Initialize scorekeeping attributes. """ + self.screen = screen self.screen_rect = screen.get_rect() self.ai_settings = ai_settings diff --git a/settings.py b/settings.py index 3b45d47..f69db1d 100644 --- a/settings.py +++ b/settings.py @@ -24,7 +24,7 @@ def __init__(self): # Alien settings self.fleet_drop_speed = 10 - # How quicly the game speeds up + # How quickly the game speeds up self.alien_speed_scale = 1.1 self.ship_speed_scale = 1.05 self.alien_score_multiplier = 1 diff --git a/ship.py b/ship.py index b136b7a..bd71cee 100644 --- a/ship.py +++ b/ship.py @@ -19,7 +19,7 @@ def __init__(self, ai_settings, screen): # Start each ship at the bottom center of the screen # Aligns the x coordinates of ship's center with x coordinates of screens center self.rect.centerx = self.screen_rect.centerx - self.rect.bottom = self.screen_rect.bottom - 5 # Push 5px from bottom of screen + self.rect.bottom = self.screen_rect.bottom - 5 # 5px from bottom of screen # Store a decimal value of the ship's center self.center = float(self.rect.centerx)