diff --git a/main.py b/main.py index aa7a335..f915054 100644 --- a/main.py +++ b/main.py @@ -133,42 +133,39 @@ while running: ananas.kill() if ananas.rect.y > HAUTEUR: gameover = True + + police = pygame.font.Font(None, 36) + texte1 = pygame.sprite.Sprite() + pygame.sprite.Sprite.__init__(texte1) + texte1.image = police.render("Gameover.", 1, (10,10,10),(255, 90, 20)) + texte1.rect = texte1.image.get_rect() + texte1.rect.centerx = 360 + texte1.rect.centery = 450 + liste_des_sprites.add(texte1) + + police = pygame.font.Font(None, 36) + texte22 = pygame.sprite.Sprite() + pygame.sprite.Sprite.__init__(texte22) + texte22.image = police.render("L'ennemi est entré dans notre atmosphère!", 1, (10,10,10),(255, 90, 20)) + texte22.rect = texte22.image.get_rect() + texte22.rect.centerx = 360 + texte22.rect.centery = 500 + liste_des_sprites.add(texte22) + + police = pygame.font.Font(None, 36) + texte33 = pygame.sprite.Sprite() + pygame.sprite.Sprite.__init__(texte33) + texte33.image = police.render("Réessaye de tuer tout les ennemis!", 1, (10,10,10),(255, 90, 20)) + texte33.rect = texte33.image.get_rect() + texte33.rect.centerx = 360 + texte33.rect.centery = 450 + liste_des_sprites.add(texte33) for missiles in liste_de_missiles: - ananas.rect.y -= 1 - if missiles.rect.colliderect(ananas): - print("COLLISION, L'OBJET A ÉTÉ ÉLIMINÉ") + missiles.rect.y -= 1 + if missiles.rect.y <= 0: liste_de_missiles.remove(missiles) - ananas.kill() - if ananas.rect.y <= 0: - gameover = True - - police = pygame.font.Font(None, 36) - texte1 = pygame.sprite.Sprite() - pygame.sprite.Sprite.__init__(texte1) - texte1.image = police.render("Gameover.", 1, (10,10,10),(255, 90, 20)) - texte1.rect = texte1.image.get_rect() - texte1.rect.centerx = 360 - texte1.rect.centery = 450 - liste_des_sprites.add(texte1) - - police = pygame.font.Font(None, 36) - texte22 = pygame.sprite.Sprite() - pygame.sprite.Sprite.__init__(texte22) - texte22.image = police.render("L'ennemi est entré dans notre atmosphère!", 1, (10,10,10),(255, 90, 20)) - texte22.rect = texte22.image.get_rect() - texte22.rect.centerx = 360 - texte22.rect.centery = 500 - liste_des_sprites.add(texte22) - - police = pygame.font.Font(None, 36) - texte33 = pygame.sprite.Sprite() - pygame.sprite.Sprite.__init__(texte33) - texte33.image = police.render("Réessaye de tuer tout les ennemis!", 1, (10,10,10),(255, 90, 20)) - texte33.rect = texte33.image.get_rect() - texte33.rect.centerx = 360 - texte33.rect.centery = 450 - liste_des_sprites.add(texte33) + missiles.kill() pygame.display.flip() fenetre.fill((0,0,0))