Compare commits

...

3 Commits

Author SHA1 Message Date
51c3d571dc remove usless if 2025-01-01 16:17:12 +01:00
3e8352aae7 bugfix texte 2025-01-01 16:16:01 +01:00
e7e0d4f5b0 fix text removing 2025-01-01 16:15:55 +01:00

109
main.py
View File

@ -34,64 +34,49 @@ liste_sprites_ananas = pygame.sprite.LayeredUpdates()
liste_des_sprites.add(avion)
liste_d_ananas = []
if running == True:
keys = pygame.key.get_pressed()
police = pygame.font.Font(None, 25)
texte = pygame.sprite.Sprite()
pygame.sprite.Sprite.__init__(texte)
texte.image = police.render("ALERTE! La planète Terre est attaquée par une flotte davions spatiaux!", 1, (10, 10, 10),(255, 90, 20))
texte.rect = texte.image.get_rect()
texte.rect.centerx = 360
texte.rect.centery = 30
liste_des_sprites.add(texte)
police = pygame.font.Font(None, 25)
texte = pygame.sprite.Sprite()
pygame.sprite.Sprite.__init__(texte)
texte.image = police.render("ALERTE! La planète Terre est attaquée par une flotte davions spatiaux!", 1, (10, 10, 10),(255, 90, 20))
texte.rect = texte.image.get_rect()
texte.rect.centerx = 360
texte.rect.centery = 30
liste_des_sprites.add(texte)
if keys[pygame.K_SPACE]:
liste_des_sprites.remove(texte)
police = pygame.font.Font(None, 20)
texte2 = pygame.sprite.Sprite()
texte2.image = police.render("Vous vous trouver dans lengin SU-PER12. Votre mission est déliminer le plus dennemis possible!", 1, (10, 10, 10),(255, 90, 20))
texte2.rect = texte2.image.get_rect()
texte2.rect.centerx = 360
texte2.rect.centery = 60
liste_des_sprites.add(texte2)
police = pygame.font.Font(None, 20)
texte2 = pygame.sprite.Sprite()
texte2.image = police.render("Vous vous trouver dans lengin SU-PER12. Votre mission est déliminer le plus dennemis possible!", 1, (10, 10, 10),(255, 90, 20))
texte2.rect = texte2.image.get_rect()
texte2.rect.centerx = 360
texte2.rect.centery = 60
liste_des_sprites.add(texte2)
if keys[pygame.K_SPACE]:
liste_des_sprites.remove(texte2)
police = pygame.font.Font(None, 20)
texte3 = pygame.sprite.Sprite()
texte3.image = police.render("Pour ce faire, appuyez sur « espace » pour tirer et bougez la souris pour manoeuvrer votre SU-PER12!", 1, (10, 10, 10),(255, 90, 20))
texte3.rect = texte3.image.get_rect()
texte3.rect.centerx = 360
texte3.rect.centery = 80
liste_des_sprites.add(texte3)
police = pygame.font.Font(None, 20)
texte3 = pygame.sprite.Sprite()
texte3.image = police.render("Pour ce faire, appuyez sur « espace » pour tirer et bougez la souris pour manoeuvrer votre SU-PER12!", 1, (10, 10, 10),(255, 90, 20))
texte3.rect = texte3.image.get_rect()
texte3.rect.centerx = 360
texte3.rect.centery = 80
liste_des_sprites.add(texte3)
if keys[pygame.K_SPACE]:
liste_des_sprites.remove(texte3)
police = pygame.font.Font(None, 20)
texte4 = pygame.sprite.Sprite()
texte4.image = police.render("Bonne chance!", 1, (10, 10, 10),(255, 90, 20))
texte4.rect = texte4.image.get_rect()
texte4.rect.centerx = 360
texte4.rect.centery = 100
liste_des_sprites.add(texte4)
police = pygame.font.Font(None, 20)
texte4 = pygame.sprite.Sprite()
texte4.image = police.render("Bonne chance!", 1, (10, 10, 10),(255, 90, 20))
texte4.rect = texte4.image.get_rect()
texte4.rect.centerx = 360
texte4.rect.centery = 100
liste_des_sprites.add(texte4)
if keys[pygame.K_SPACE]:
liste_des_sprites.remove(texte4)
police = pygame.font.Font(None, 20)
texte5 = pygame.sprite.Sprite()
texte5.image = police.render("ALERTE, PLANETE TERRE EST SOUS ATTAQUE", 1, (10, 10, 10),(255, 90, 20))
texte5.rect = texte5.image.get_rect()
texte5.rect.centerx = 360
texte5.rect.centery = 1500
liste_des_sprites.add(texte5)
police = pygame.font.Font(None, 20)
texte5 = pygame.sprite.Sprite()
texte5.image = police.render("ALERTE, PLANETE TERRE EST SOUS ATTAQUE", 1, (10, 10, 10),(255, 90, 20))
texte5.rect = texte5.image.get_rect()
texte5.rect.centerx = 360
texte5.rect.centery = 1500
liste_des_sprites.add(texte5)
if keys[pygame.K_SPACE]:
liste_des_sprites.remove(texte5)
gameover = False
score = 0
gameover = False
score = 0
while running:
@ -107,6 +92,10 @@ while running:
keys = pygame.key.get_pressed()
if keys[pygame.K_SPACE]:
liste_des_sprites.remove(texte)
liste_des_sprites.remove(texte2)
liste_des_sprites.remove(texte3)
liste_des_sprites.remove(texte4)
liste_des_sprites.remove(texte5)
if gameover == False:
nombre_aleatoire = randint(0, 100)
if nombre_aleatoire == 100:
@ -126,9 +115,9 @@ while running:
police = pygame.font.Font(None, 36)
texte1 = pygame.sprite.Sprite()
pygame.sprite.Sprite.__init__(texte)
texte.image = police.render("Gameover.", 1, (10,10,10),(255, 90, 20))
texte1.rect = texte.image.get_rect()
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)
@ -136,8 +125,8 @@ while running:
police = pygame.font.Font(None, 36)
texte22 = pygame.sprite.Sprite()
pygame.sprite.Sprite.__init__(texte22)
texte.image = police.render("L'ennemi est entré dans notre atmosphère!", 1, (10,10,10),(255, 90, 20))
texte22.rect = texte.image.get_rect()
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)
@ -145,8 +134,8 @@ while running:
police = pygame.font.Font(None, 36)
texte33 = pygame.sprite.Sprite()
pygame.sprite.Sprite.__init__(texte33)
texte.image = police.render("L'ennemi est entré dans notre atmosphère!", 1, (10,10,10),(255, 90, 20))
texte33.rect = texte.image.get_rect()
texte33.image = police.render("L'ennemi est entré dans notre atmosphère!", 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)