Skip to content

Commit

Permalink
Published to Github
Browse files Browse the repository at this point in the history
  • Loading branch information
0mppula committed Mar 23, 2021
1 parent 480772a commit 0db273b
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/resources/images/img_resources
*.pyc
*.pyc
*.psd
1 change: 1 addition & 0 deletions alien.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions alien_invasion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions bullet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion button.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions game_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions game_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 0 additions & 1 deletion menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 7 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
@@ -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!
2 changes: 1 addition & 1 deletion resources/colors/color_schema.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Color Schema --
--- Color Schema ---
1. Black: (20, 20, 20)
2. Menu: (45, 53, 89)
3. score/txt: (226, 188, 0)
Expand Down
1 change: 1 addition & 0 deletions scoreboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ship.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0db273b

Please sign in to comment.