-
Notifications
You must be signed in to change notification settings - Fork 234
play and pause added, show Highscore, Lives of the player improved to 3 #29
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request required A LOT of changes to be made.
## group all the sprites together for ease of update | ||
|
||
# group all the sprites together for ease of update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand your intentions, but it is not good to look at all those not sufficient changed during code review. Maybe it needs to be done in separate commit?
pygame.mixer.music.stop() | ||
#Play the gameplay music | ||
pygame.mixer.music.load(path.join(sound_folder, 'tgfcoder-FrozenJam-SeamlessLoop.ogg')) | ||
pygame.mixer.music.play(-1) ## makes the gameplay sound in an endless loop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you refactored this code somehow or it have been deleted completely? If it was refactored then show where, if deleted - explain why.
## as there will be no mob_elements left out | ||
for hit in hits: | ||
score += 50 - hit.radius ## give different scores for hitting big and small metoers | ||
random.choice(expl_sounds).play() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, looks like you have deleted sound effect completely. Explain yourself.
hits = pygame.sprite.spritecollide( | ||
player, mobs, True, pygame.sprite.collide_circle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, do not refactor the code if you aren't changing anything. You are committing logic changes, not PEP8 refactoring.
all_sprites.add(expl) | ||
newmob() | ||
if player.shield <= 0: | ||
player_die_sound.play() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have removed sound effect, why?
if reset == False: | ||
break | ||
else: | ||
reset = False | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are using reset
to quit "main" loop controlled by variable running
, why not just use it instead?
screen.fill(BLACK) | ||
screen.blit(background, background_rect) | ||
pygame.display.update() | ||
while True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like to add some meaning to it, like making running_game_over
variable?
if ev.key == pygame.K_RETURN: | ||
break | ||
elif ev.key == pygame.K_ESCAPE: | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be grouped up
if env.key in [pygame.K_RETURN, pygame.K_ESCAPE]:
break | ||
elif ev.key == pygame.K_r: | ||
reset = True | ||
player.lives = 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your commit message says
improved to 3
but I see 5. How is that?
Also, you haven't changed initial/default value in Player.__init__
spaceShooter/spaceshooter/spaceShooter.py
Line 169 in 1867d77
self.lives = 3 |
or made it match this one.
Play /pause added.
HighScore and Restart the game option once all the lives exhaust.
Lives of the player increased by 3.