Skip to content

Commit

Permalink
🐛 chagnes and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
anarghya-das committed Dec 22, 2019
1 parent 6f70baf commit df8f378
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A space shooter game created using [Pygame](https://www.pygame.org/). The main o

For windows users, you can download the setup file [here]() or look at the latest [release](https://github.com/anarghya-das/Space-Invader/releases). Install the game and go to the folder where you installed it and run **main.exe**.

For Linux and Mac users, make sure you have python3 and pygame install (see contribution for more details). Clone or download this repository as a zip file and then run the main.py file.
For Linux and Mac users, make sure you have python3 and pygame install (see contribution for more details). Clone or download this repository as a zip file and then run the main.py file.

## Game Instructions

Expand All @@ -16,4 +16,4 @@ Basic game controls:

- **Movement:** Move your spaceship using the right or left arrow keys.
- **Laser:** Use spacebar to shoot laser towards your enemies.
- **General:** Press escape to pause the game and enter to resume the game.
- **General:** Press escape to pause the game and enter to resume the game.
12 changes: 8 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@ def show_score(score):
screen.blit(s, (scoreX, scoreY))


def show_over():
def show_over(score):
over = pygame.font.Font('freesansbold.ttf', 82)
mediumText = pygame.font.Font('freesansbold.ttf', 42)
s, end = text_objects("Game Over!", over, WHITE)
end.center = (math.floor(SCREEN_WIDTH/2),
math.floor(SCREEN_HEIGHT/2))
score, srect = text_objects(f"Final Score: {score}", mediumText, WHITE)
srect.center = (math.floor(SCREEN_WIDTH/2),
math.floor(SCREEN_HEIGHT/2)+70)
enter, rect = text_objects(
"Press Enter to Restart", mediumText, WHITE)
rect.center = (math.floor(SCREEN_WIDTH/2),
math.floor(SCREEN_HEIGHT/2)+70)
math.floor(SCREEN_HEIGHT/2)+120)
screen.blit(s, end)
screen.blit(score, srect)
screen.blit(enter, rect)


Expand Down Expand Up @@ -149,7 +153,7 @@ def game(playerX_change_value, enemyX_change_value, enemyY_change, enemy_count,
screen.blit(background, (0, 0))
if game_over:
pygame.mixer.music.stop()
show_over()
show_over(score)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
Expand Down Expand Up @@ -294,7 +298,7 @@ def main():
pygame.display.set_caption("Space Invaders")

# Difficulty Values which can be modified to increase or decrease the game difficulty
difficulty_step = 10 # After every 10 points scored the difficulty increases
difficulty_step = 10 # After every 10 points scored the difficulty increases
bullet_speed = 5
playerX_change_value = 5
enemyX_change_value = 5
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
cx_Freeze.setup(
name="Space Invader",
options={"build_exe": {"packages": ["pygame"],
"include_files": ["back.jpg", "bullet.png", "enemy.png", "player.png"]}},
"include_files": ["assests/"]}},
executables=executables
)

0 comments on commit df8f378

Please sign in to comment.