Compare commits
1 Commits
85db1d9f6c
...
24c1a35c7d
Author | SHA1 | Date | |
---|---|---|---|
24c1a35c7d |
65
main.py
65
main.py
@ -114,7 +114,6 @@ while running:
|
|||||||
avion.rect.x = event.pos[0]
|
avion.rect.x = event.pos[0]
|
||||||
if event.type == MOUSEBUTTONDOWN:
|
if event.type == MOUSEBUTTONDOWN:
|
||||||
print("Vous avez tué l'ennemi! Continuez!")
|
print("Vous avez tué l'ennemi! Continuez!")
|
||||||
liste_d_ananas.remove(ananas)
|
|
||||||
nouveau_missile = tirer_missiles(avion.rect.centerx, HAUTEUR/2)
|
nouveau_missile = tirer_missiles(avion.rect.centerx, HAUTEUR/2)
|
||||||
liste_de_missiles.append(nouveau_missile) == [nouveau_missile]
|
liste_de_missiles.append(nouveau_missile) == [nouveau_missile]
|
||||||
liste_sprites_missiles.add(nouveau_missile) == pygame.sprite.Group(nouveau_missile)
|
liste_sprites_missiles.add(nouveau_missile) == pygame.sprite.Group(nouveau_missile)
|
||||||
@ -132,45 +131,41 @@ while running:
|
|||||||
print("COLLISION, L'OBJET A ÉTÉ ÉLIMINÉ, MALHEUREUSEMENT, VOUS AUSSI")
|
print("COLLISION, L'OBJET A ÉTÉ ÉLIMINÉ, MALHEUREUSEMENT, VOUS AUSSI")
|
||||||
liste_d_ananas.remove(ananas)
|
liste_d_ananas.remove(ananas)
|
||||||
ananas.kill()
|
ananas.kill()
|
||||||
gameover = True
|
|
||||||
if ananas.rect.y > HAUTEUR:
|
if ananas.rect.y > HAUTEUR:
|
||||||
gameover = True
|
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:
|
for missiles in liste_de_missiles:
|
||||||
ananas.rect.y -= 1
|
missiles.rect.y -= 1
|
||||||
if missiles.rect.colliderect(ananas):
|
if missiles.rect.y <= 0:
|
||||||
print("COLLISION, L'OBJET A ÉTÉ ÉLIMINÉ")
|
|
||||||
liste_de_missiles.remove(missiles)
|
liste_de_missiles.remove(missiles)
|
||||||
ananas.kill()
|
missiles.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)
|
|
||||||
|
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
fenetre.fill((0,0,0))
|
fenetre.fill((0,0,0))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user