Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Da-Colon committed Sep 11, 2019
2 parents 230d49e + 53a9731 commit 687ad23
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
Binary file modified .DS_Store
Binary file not shown.
44 changes: 23 additions & 21 deletions MoonSet.py
Expand Up @@ -25,6 +25,8 @@
pygame.time.set_timer(ENEMY_FIRE, 1000)
BOSS_FIRE = pygame.USEREVENT
pygame.time.set_timer(BOSS_FIRE, 1000)
WIN_GAME = pygame.USEREVENT
pygame.time.set_timer(WIN_GAME, 1000)


# Initialize pygame and create window
Expand Down Expand Up @@ -470,7 +472,8 @@ def end_game():
pygame.mixer.music.stop()
pygame.mixer.music.load(path.join(snd_dir, 'fanfare.mp3'))
pygame.mixer.music.play()
pygame.mixer.music.set_volume(0.6)
pygame.mixer.music.set_volume(1)




Expand Down Expand Up @@ -569,7 +572,7 @@ def end_game():
a.kill()
all_sprites.add(rita)
rita_group.add(rita)


for event in pygame.event.get():
# check for closing window
Expand All @@ -583,10 +586,6 @@ def end_game():
if event.key == pygame.K_SPACE:
if player2.shield > 0:
player2.shoot()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_t:
for a in mob:
a.shoot()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
running = False
Expand All @@ -598,9 +597,14 @@ def end_game():
if rita.shield > 0:
if event.type == BOSS_FIRE:
rita.shoot()
if rita.shield <= 0:
if event.type == WIN_GAME:
congratulations = True


# * Update
all_sprites.update()

if progress >= 100: #BOSS SPAWN UPDATE / RITA SPAWN UPDATE
rita_group.update()
if not music_on:
Expand All @@ -615,7 +619,8 @@ def end_game():
score += 50 - hit.radius
progress += 3
random.choice(expl_sound).play()
expl = Explosion(hit.rect.center, 'lg') # ! EXPLOSIONS HIT
# ! EXPLOSIONS HIT
expl = Explosion(hit.rect.center, 'lg')
all_sprites.add(expl)

#! BOSS HIT
Expand Down Expand Up @@ -653,17 +658,17 @@ def boom():
if player2.shield <= 0:
player2.kill()

# check to see if boss hits the player
#! Player 1 Boss hit
# check to see if boss hits the player
#! Player 1 Boss hit
hits = pygame.sprite.spritecollide(
player, rita_group, True, pygame.sprite.collide_circle)
for hit in hits:
player.shield -= hit.radius * 2
if player.shield <= 0:
player.kill()

# check to see if a boss hit the player2
#! Player 2 boss hit
# check to see if a boss hit the player2
#! Player 2 boss hit
hits = pygame.sprite.spritecollide(
player2, rita_group, True, pygame.sprite.collide_circle)
for hit in hits:
Expand All @@ -680,18 +685,15 @@ def boom():

#! DEATH OF RITA
def wait():
pygame.time.delay(1000)
if rita.shield <= 0:
expl3 = Explosion(hit.rect.center, 'xxl')
random.choice(expl_sound).play()
all_sprites.add(expl3)
rita.kill()
pygame.time.wait(50)
congratulations = True


return congratulations
if rita.shield <= 0:
wait()
rita.kill()




# check to see if an enemy bullet hit the players
#! MOB BULLET HIT PLAYER 1
hits = pygame.sprite.spritecollide(
Expand Down Expand Up @@ -723,4 +725,4 @@ def wait():
# *after* drawing everything, flip the display
pygame.display.flip()

pygame.quit()
pygame.quit()

0 comments on commit 687ad23

Please sign in to comment.