diff --git a/V3/coeur.png b/V3/coeur.png deleted file mode 100644 index a976989..0000000 Binary files a/V3/coeur.png and /dev/null differ diff --git a/V4/balle.png b/V4/balle.png deleted file mode 100644 index e1f3d1b..0000000 Binary files a/V4/balle.png and /dev/null differ diff --git a/V4/joueur.png b/V4/joueur.png deleted file mode 100644 index 68bc23f..0000000 Binary files a/V4/joueur.png and /dev/null differ diff --git a/V4/terrain.png b/V4/terrain.png deleted file mode 100644 index 7be2ebe..0000000 Binary files a/V4/terrain.png and /dev/null differ diff --git a/V5.5/balle.png b/V5.5/balle.png deleted file mode 100644 index e1f3d1b..0000000 Binary files a/V5.5/balle.png and /dev/null differ diff --git a/V5.5/coeur.png b/V5.5/coeur.png deleted file mode 100644 index 314e286..0000000 Binary files a/V5.5/coeur.png and /dev/null differ diff --git a/V5.5/coeurfaded.png b/V5.5/coeurfaded.png deleted file mode 100644 index e6d4def..0000000 Binary files a/V5.5/coeurfaded.png and /dev/null differ diff --git a/V5.5/joueur.png b/V5.5/joueur.png deleted file mode 100644 index 68bc23f..0000000 Binary files a/V5.5/joueur.png and /dev/null differ diff --git a/V5.5/terrain.png b/V5.5/terrain.png deleted file mode 100644 index 7be2ebe..0000000 Binary files a/V5.5/terrain.png and /dev/null differ diff --git a/V5.6/.logs.csv b/V5.6/.logs.csv deleted file mode 100644 index 89b04dc..0000000 --- a/V5.6/.logs.csv +++ /dev/null @@ -1,2 +0,0 @@ -score;moy;best;nbparties -0;10;50;3 \ No newline at end of file diff --git a/V5.6/1.png b/V5.6/1.png deleted file mode 100644 index 893c8ff..0000000 Binary files a/V5.6/1.png and /dev/null differ diff --git a/V5.6/10.png b/V5.6/10.png deleted file mode 100644 index 68bc23f..0000000 Binary files a/V5.6/10.png and /dev/null differ diff --git a/V5.6/2.png b/V5.6/2.png deleted file mode 100644 index 559e110..0000000 Binary files a/V5.6/2.png and /dev/null differ diff --git a/V5.6/3.png b/V5.6/3.png deleted file mode 100644 index 185a188..0000000 Binary files a/V5.6/3.png and /dev/null differ diff --git a/V5.6/4.png b/V5.6/4.png deleted file mode 100644 index c345ebc..0000000 Binary files a/V5.6/4.png and /dev/null differ diff --git a/V5.6/5.png b/V5.6/5.png deleted file mode 100644 index a510511..0000000 Binary files a/V5.6/5.png and /dev/null differ diff --git a/V5.6/6.png b/V5.6/6.png deleted file mode 100644 index a8d4b93..0000000 Binary files a/V5.6/6.png and /dev/null differ diff --git a/V5.6/7.png b/V5.6/7.png deleted file mode 100644 index 0b8640d..0000000 Binary files a/V5.6/7.png and /dev/null differ diff --git a/V5.6/8.png b/V5.6/8.png deleted file mode 100644 index 9904e80..0000000 Binary files a/V5.6/8.png and /dev/null differ diff --git a/V5.6/9.png b/V5.6/9.png deleted file mode 100644 index 7d13cf3..0000000 Binary files a/V5.6/9.png and /dev/null differ diff --git a/V5.6/balle.png b/V5.6/balle.png deleted file mode 100644 index e1f3d1b..0000000 Binary files a/V5.6/balle.png and /dev/null differ diff --git a/V5.6/coeur.png b/V5.6/coeur.png deleted file mode 100644 index 314e286..0000000 Binary files a/V5.6/coeur.png and /dev/null differ diff --git a/V5.6/coeurfaded.png b/V5.6/coeurfaded.png deleted file mode 100644 index e6d4def..0000000 Binary files a/V5.6/coeurfaded.png and /dev/null differ diff --git a/V5.6/joueur.png b/V5.6/joueur.png deleted file mode 100644 index 68bc23f..0000000 Binary files a/V5.6/joueur.png and /dev/null differ diff --git a/V5.6/terrain.png b/V5.6/terrain.png deleted file mode 100644 index 7be2ebe..0000000 Binary files a/V5.6/terrain.png and /dev/null differ diff --git a/V5/balle.png b/V5/balle.png deleted file mode 100644 index e1f3d1b..0000000 Binary files a/V5/balle.png and /dev/null differ diff --git a/V5/coeur.png b/V5/coeur.png deleted file mode 100644 index 314e286..0000000 Binary files a/V5/coeur.png and /dev/null differ diff --git a/V5/coeurfaded.png b/V5/coeurfaded.png deleted file mode 100644 index e6d4def..0000000 Binary files a/V5/coeurfaded.png and /dev/null differ diff --git a/V5/joueur.png b/V5/joueur.png deleted file mode 100644 index 68bc23f..0000000 Binary files a/V5/joueur.png and /dev/null differ diff --git a/V5/terrain.png b/V5/terrain.png deleted file mode 100644 index 7be2ebe..0000000 Binary files a/V5/terrain.png and /dev/null differ diff --git a/.logs.csv b/assets/.logs.csv similarity index 69% rename from .logs.csv rename to assets/.logs.csv index 936cf39..8b7f3be 100644 --- a/.logs.csv +++ b/assets/.logs.csv @@ -1,2 +1,2 @@ score;moy;best;nbparties -0;7.5;50;4 \ No newline at end of file +0;0.0;50;7 diff --git a/V5.5/1.png b/assets/1.png similarity index 100% rename from V5.5/1.png rename to assets/1.png diff --git a/V5.5/10.png b/assets/10.png similarity index 100% rename from V5.5/10.png rename to assets/10.png diff --git a/V5.5/2.png b/assets/2.png similarity index 100% rename from V5.5/2.png rename to assets/2.png diff --git a/V5.5/3.png b/assets/3.png similarity index 100% rename from V5.5/3.png rename to assets/3.png diff --git a/V5.5/4.png b/assets/4.png similarity index 100% rename from V5.5/4.png rename to assets/4.png diff --git a/V5.5/5.png b/assets/5.png similarity index 100% rename from V5.5/5.png rename to assets/5.png diff --git a/V5.5/6.png b/assets/6.png similarity index 100% rename from V5.5/6.png rename to assets/6.png diff --git a/V5.5/7.png b/assets/7.png similarity index 100% rename from V5.5/7.png rename to assets/7.png diff --git a/V5.5/8.png b/assets/8.png similarity index 100% rename from V5.5/8.png rename to assets/8.png diff --git a/V5.5/9.png b/assets/9.png similarity index 100% rename from V5.5/9.png rename to assets/9.png diff --git a/V3/balle.png b/assets/balle.png similarity index 100% rename from V3/balle.png rename to assets/balle.png diff --git a/V4/coeur.png b/assets/coeur.png similarity index 100% rename from V4/coeur.png rename to assets/coeur.png diff --git a/V4/coeurfaded.png b/assets/coeurfaded.png similarity index 100% rename from V4/coeurfaded.png rename to assets/coeurfaded.png diff --git a/V3/joueur.png b/assets/joueur.png similarity index 100% rename from V3/joueur.png rename to assets/joueur.png diff --git a/V5.6/output_folder/mp3/0.mp3 b/assets/mp3/0.mp3 similarity index 100% rename from V5.6/output_folder/mp3/0.mp3 rename to assets/mp3/0.mp3 diff --git a/V5.6/output_folder/mp3/1.mp3 b/assets/mp3/1.mp3 similarity index 100% rename from V5.6/output_folder/mp3/1.mp3 rename to assets/mp3/1.mp3 diff --git a/V5.6/output_folder/mp3/10.mp3 b/assets/mp3/10.mp3 similarity index 100% rename from V5.6/output_folder/mp3/10.mp3 rename to assets/mp3/10.mp3 diff --git a/V5.6/output_folder/mp3/11.mp3 b/assets/mp3/11.mp3 similarity index 100% rename from V5.6/output_folder/mp3/11.mp3 rename to assets/mp3/11.mp3 diff --git a/V5.6/output_folder/mp3/12.mp3 b/assets/mp3/12.mp3 similarity index 100% rename from V5.6/output_folder/mp3/12.mp3 rename to assets/mp3/12.mp3 diff --git a/V5.6/output_folder/mp3/13.mp3 b/assets/mp3/13.mp3 similarity index 100% rename from V5.6/output_folder/mp3/13.mp3 rename to assets/mp3/13.mp3 diff --git a/V5.6/output_folder/mp3/14.mp3 b/assets/mp3/14.mp3 similarity index 100% rename from V5.6/output_folder/mp3/14.mp3 rename to assets/mp3/14.mp3 diff --git a/V5.6/output_folder/mp3/15.mp3 b/assets/mp3/15.mp3 similarity index 100% rename from V5.6/output_folder/mp3/15.mp3 rename to assets/mp3/15.mp3 diff --git a/V5.6/output_folder/mp3/16.mp3 b/assets/mp3/16.mp3 similarity index 100% rename from V5.6/output_folder/mp3/16.mp3 rename to assets/mp3/16.mp3 diff --git a/V5.6/output_folder/mp3/2.mp3 b/assets/mp3/2.mp3 similarity index 100% rename from V5.6/output_folder/mp3/2.mp3 rename to assets/mp3/2.mp3 diff --git a/V5.6/output_folder/mp3/3.mp3 b/assets/mp3/3.mp3 similarity index 100% rename from V5.6/output_folder/mp3/3.mp3 rename to assets/mp3/3.mp3 diff --git a/V5.6/output_folder/mp3/4.mp3 b/assets/mp3/4.mp3 similarity index 100% rename from V5.6/output_folder/mp3/4.mp3 rename to assets/mp3/4.mp3 diff --git a/V5.6/output_folder/mp3/5.mp3 b/assets/mp3/5.mp3 similarity index 100% rename from V5.6/output_folder/mp3/5.mp3 rename to assets/mp3/5.mp3 diff --git a/V5.6/output_folder/mp3/6.mp3 b/assets/mp3/6.mp3 similarity index 100% rename from V5.6/output_folder/mp3/6.mp3 rename to assets/mp3/6.mp3 diff --git a/V5.6/output_folder/mp3/7.mp3 b/assets/mp3/7.mp3 similarity index 100% rename from V5.6/output_folder/mp3/7.mp3 rename to assets/mp3/7.mp3 diff --git a/V5.6/output_folder/mp3/8.mp3 b/assets/mp3/8.mp3 similarity index 100% rename from V5.6/output_folder/mp3/8.mp3 rename to assets/mp3/8.mp3 diff --git a/V5.6/output_folder/mp3/9.mp3 b/assets/mp3/9.mp3 similarity index 100% rename from V5.6/output_folder/mp3/9.mp3 rename to assets/mp3/9.mp3 diff --git a/V5.6/smiley.png b/assets/smiley.png similarity index 100% rename from V5.6/smiley.png rename to assets/smiley.png diff --git a/V3/terrain.png b/assets/terrain.png similarity index 100% rename from V3/terrain.png rename to assets/terrain.png diff --git a/flemmedetaper.py b/flemmedetaper.py deleted file mode 100644 index efdf9a0..0000000 --- a/flemmedetaper.py +++ /dev/null @@ -1,28 +0,0 @@ -# player_image = pygame.image.load("V5/joueur.png") -# player_image = pygame.transform.scale(pygame.image.load("V5/joueur.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) # Au cas où l'image fait pas la bonne taille - -# for i in range (1,11): -# print('sprite_image_', i, ' = pygame.transform.scale(pygame.image.load("V5.5/', i, '.png"), (SPRITE_WIDTH, SPRITE_HEIGHT))', sep='') - - -SPRITE_WIDTH = 100 # Largeur d'un sprite -SPRITE_HEIGHT = 100 # Hauteur d'un sprite -SPACING_X = 20 # Espacement horizontal entre les sprites -SPACING_Y = 20 # Espacement vertical entre les lignes de sprites -SCREEN_WIDTH = 800 # Largeur de l'écran -SCREEN_HEIGHT = 600 # Hauteur de l'écran - -# Calculer les coordonnées de position des sprites -start_x = (SCREEN_WIDTH - (SPRITE_WIDTH * 5 + SPACING_X * 4)) // 2 -start_y = (SCREEN_HEIGHT - (SPRITE_HEIGHT * 2 + SPACING_Y)) // 2 -listex = [] -listey = [] -for row in range(2): - for col in range(5): - x = start_x + col * (SPRITE_WIDTH + SPACING_X) - y = start_y + row * (SPRITE_HEIGHT + SPACING_Y) - listex.append(x) - listey.append(y) - -print('listex = ', listex, sep='') -print('listey = ' , listey, sep='') \ No newline at end of file diff --git a/jeu V1.py b/jeu V1.py deleted file mode 100644 index e1bb4a9..0000000 --- a/jeu V1.py +++ /dev/null @@ -1,104 +0,0 @@ -import pygame -import random -import sys -import time - -pygame.init() -game_over = False -game_over_time = None - -WIDTH = 800 -HEIGHT = 600 - -screen = pygame.display.set_mode((WIDTH, HEIGHT)) -pygame.display.set_caption("Jeu V1") - -# Couleurs -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) - -# Paramètres de la balle -BALL_RADIUS = 30 -ball_pos = [WIDTH // 2, BALL_RADIUS] # Position initiale de la balle - -# Paramètres du joueur -PLAYER_WIDTH = 80 -PLAYER_HEIGHT = 20 -player_pos = [WIDTH // 2 - PLAYER_WIDTH // 2, HEIGHT - PLAYER_HEIGHT - 60] # Position initiale du joueur -player_speed = 10 # Vitesse de déplacement du joueur - -# Variables du jeu -clock = pygame.time.Clock() -running = True - -ball_velocity_y = 0 # Vélocité verticale initiale -ball_velocity_x = 1 # Vélocité horizontale initiale -gravity = 0.1 # Accélération due à la gravité - -score = 0 # Le score au début de la partie -font = pygame.font.Font(None, 36) # Crée une police pour le texte (taille 36) - - -while running: - for event in pygame.event.get(): - if event.type == pygame.QUIT: - running = False - - # Gestion des mouvements du joueur - mouse_pos = pygame.mouse.get_pos() - player_pos[0] = mouse_pos[0] - PLAYER_WIDTH // 2 # Met à jour la position du joueur en fonction de la position de la souris - - # Mise à jour de la logique du jeu - - - #gravity - ball_velocity_y += gravity # Applique l'accélération due à la gravité à la vélocité - ball_pos[1] += ball_velocity_y # Met à jour la position verticale de la balle en fonction de la vélocité - - # Si la balle touche le joueur - if ball_pos[1] + BALL_RADIUS >= player_pos[1] and ball_pos[0] >= player_pos[0] and ball_pos[0] <= player_pos[0] + PLAYER_WIDTH: # Si y'a collision avec le joueur - ball_pos[1] = player_pos[1] - BALL_RADIUS # Rétablit la position de la balle au-dessus du joueur - ball_velocity_y = -ball_velocity_y # Inverse la vélocité verticale pour simuler le rebond - score += 1 # Incrémente le score - ball_velocity_x += random.uniform(-2, 2) # Change la vélocité horizontale de la balle - print("Score :", score) # Affiche le score à la console (remplace par ton propre code d'affichage) - - - # Si la balle touche le sol - if ball_pos[1] + BALL_RADIUS >= HEIGHT: - game_over = True # Active l'état "game_over" - ball_pos[1] = HEIGHT + BALL_RADIUS # Déplace la balle hors de l'écran pour la cacher - player_pos[1] = HEIGHT + PLAYER_HEIGHT # Déplace le joueur hors de l'écran pour le cacher - print('game over') - - - elif ball_pos[1] <= BALL_RADIUS: - ball_pos[1] = BALL_RADIUS # Rétablit la position de la balle à l'intérieur de l'écran - ball_velocity_y = -ball_velocity_y # Inverse la vélocité pour simuler le rebond - - - # Partie pour faire en sorte que la balle se déplace de gauche à droite - # Mise à jour de la logique du jeu - ball_pos[0] += ball_velocity_x # Met à jour la position horizontale de la balle en fonction de la vélocité horizontale - - # Vérifie la collision avec les bords gauche et droit de l'écran - if ball_pos[0] <= BALL_RADIUS or ball_pos[0] >= WIDTH - BALL_RADIUS: - ball_velocity_x = -ball_velocity_x # Inverse la vélocité horizontale pour changer la direction de la balle - - - # Dessiner les éléments - screen.fill(BLACK) - pygame.draw.circle(screen, WHITE, ball_pos, BALL_RADIUS) - pygame.draw.rect(screen, WHITE, (player_pos[0], player_pos[1], PLAYER_WIDTH, PLAYER_HEIGHT)) - - # Le score - text = font.render("Score: " + str(score), True, WHITE) # Convertit le score en chaîne de caractères et crée un objet de texte - text_rect = text.get_rect() - text_rect.center = (WIDTH // 2, 20) # Positionne le texte au centre en haut de l'écran - screen.blit(text, text_rect) # Affiche le texte sur l'écran - - # Rafraîchissement de l'écran - pygame.display.flip() - clock.tick(60) # Limite le taux de rafraîchissement à 60 FPS - -pygame.quit() diff --git a/jeu V2.py b/jeu V2.py deleted file mode 100644 index 767695f..0000000 --- a/jeu V2.py +++ /dev/null @@ -1,112 +0,0 @@ -import pygame -import random -import sys - -pygame.init() - -# Paramètres de l'écran -WIDTH = 800 -HEIGHT = 600 - -# Couleurs -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) - -# Paramètres de la balle -BALL_RADIUS = 30 - -# Paramètres du joueur -PLAYER_WIDTH = 80 -PLAYER_HEIGHT = 20 - -# Variables du jeu -score = 0 -font = pygame.font.Font(None, 36) - -# Initialisation de l'écran de jeu -screen = pygame.display.set_mode((WIDTH, HEIGHT)) -pygame.display.set_caption("Jeu V2") - -def game(): - global score - - # Position initiale de la balle - ball_pos = [WIDTH // 2, BALL_RADIUS] - ball_velocity_y = 0 - ball_velocity_x = 1 - gravity = 0.1 - - # Position initiale du joueur - player_pos = [WIDTH // 2 - PLAYER_WIDTH // 2, HEIGHT - PLAYER_HEIGHT - 60] - - clock = pygame.time.Clock() - running = True - - while running: - for event in pygame.event.get(): - if event.type == pygame.QUIT: - pygame.quit() - sys.exit() - - # Gestion des mouvements du joueur - mouse_pos = pygame.mouse.get_pos() - player_pos[0] = mouse_pos[0] - PLAYER_WIDTH // 2 - - # Mise à jour de la logique du jeu - ball_velocity_y += gravity - ball_pos[1] += ball_velocity_y - - # Si la balle touche le joueur - if ball_pos[1] + BALL_RADIUS >= player_pos[1] and ball_pos[0] >= player_pos[0] and ball_pos[0] <= player_pos[0] + PLAYER_WIDTH: - ball_pos[1] = player_pos[1] - BALL_RADIUS - ball_velocity_y = -ball_velocity_y - score += 1 - ball_velocity_x += random.uniform(-2, 2) - print("Score :", score) - - # Si la balle touche le sol - if ball_pos[1] + BALL_RADIUS >= HEIGHT: - return False - - elif ball_pos[1] <= BALL_RADIUS: - ball_pos[1] = BALL_RADIUS - ball_velocity_y = -ball_velocity_y - - ball_pos[0] += ball_velocity_x - - if ball_pos[0] <= BALL_RADIUS or ball_pos[0] >= WIDTH - BALL_RADIUS: - ball_velocity_x = -ball_velocity_x - - screen.fill(BLACK) - pygame.draw.circle(screen, WHITE, ball_pos, BALL_RADIUS) - pygame.draw.rect(screen, WHITE, (player_pos[0], player_pos[1], PLAYER_WIDTH, PLAYER_HEIGHT)) - - text = font.render("Score: " + str(score), True, WHITE) - text_rect = text.get_rect() - text_rect.center = (WIDTH // 2, 20) - screen.blit(text, text_rect) - - pygame.display.flip() - clock.tick(60) - -def game_over_screen(): - screen.fill(BLACK) - perdu_text = font.render("Perdu", True, WHITE) - perdu_text_rect = perdu_text.get_rect() - perdu_text_rect.centerx = WIDTH // 2 - perdu_text_rect.centery = HEIGHT // 2 - screen.blit(perdu_text, perdu_text_rect) - pygame.display.flip() - pygame.time.wait(3000) - -# Boucle principale -running = True -while running: - score = 0 - game_over = game() - print(game_over) - if game_over == False: - game_over_screen() - running = False - -pygame.quit() diff --git a/jeu V3.py b/jeu V3.py deleted file mode 100644 index 004b8f7..0000000 --- a/jeu V3.py +++ /dev/null @@ -1,128 +0,0 @@ -import pygame -import random -import sys - -pygame.init() - -# Paramètres de l'écran -WIDTH = 800 -HEIGHT = 600 - -# Couleurs -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) - -# Paramètres de la balle -BALL_WIDTH = 50 -BALL_HEIGHT = 50 -BALL_RADIUS = 50//2 - -# Paramètres du joueur -PLAYER_WIDTH = 80 -PLAYER_HEIGHT = 80 - -# Images choisies -player_image = pygame.image.load("V3/joueur.png") -player_image = pygame.transform.scale(player_image, (PLAYER_WIDTH, PLAYER_HEIGHT)) # Au cas où l'image fait pas la bonne taille -ball_image = pygame.image.load("V3/balle.png") -ball_image = pygame.transform.scale(ball_image, (BALL_WIDTH, BALL_HEIGHT)) # Au cas où l'image fait pas la bonne taille -background_image = pygame.image.load("V3/terrain.png") -background_image = pygame.transform.scale(background_image, (WIDTH, HEIGHT)) # Au cas où l'image fait pas la bonne taille - -# Variables du jeu -score = 0 -font = pygame.font.Font(None, 36) - -# Initialisation de l'écran de jeu -screen = pygame.display.set_mode((WIDTH, HEIGHT)) -pygame.display.set_caption("Jeu V3") - -def game(): - global score - - # Position initiale de la balle - ball_pos = [WIDTH // 2, BALL_RADIUS] - ball_velocity_y = 0 - ball_velocity_x = 1 - gravity = 0.1 - - # Position initiale du joueur - player_pos = [WIDTH // 2 - PLAYER_WIDTH // 2, HEIGHT - PLAYER_HEIGHT - 60] - - clock = pygame.time.Clock() - running = True - - while running: - for event in pygame.event.get(): - if event.type == pygame.QUIT: - pygame.quit() - sys.exit() - - # Gestion des mouvements du joueur - mouse_pos = pygame.mouse.get_pos() - player_pos[0] = mouse_pos[0] - PLAYER_WIDTH // 2 - - # Mise à jour de la logique du jeu - ball_velocity_y += gravity - ball_pos[1] += ball_velocity_y - - # Si la balle touche le joueur - if ball_pos[1] + BALL_RADIUS >= player_pos[1] and ball_pos[0] >= player_pos[0] and ball_pos[0] <= player_pos[0] + PLAYER_WIDTH: - ball_pos[1] = player_pos[1] - BALL_RADIUS - ball_velocity_y = -ball_velocity_y - score += 1 - ball_velocity_x += random.uniform(-3, 3) - print("Score :", score) - - # Si la balle touche le sol - if ball_pos[1] + BALL_RADIUS >= HEIGHT: - return False - - elif ball_pos[1] <= BALL_RADIUS: - ball_pos[1] = BALL_RADIUS - ball_velocity_y = -ball_velocity_y - - ball_pos[0] += ball_velocity_x - - # Si la balle touche les murs - if ball_pos[0] <= BALL_RADIUS or ball_pos[0]+BALL_RADIUS//2 >= WIDTH: - ball_velocity_x = -ball_velocity_x - - # Dessiner les éléments - screen.blit(background_image, (0, 0)) # Le terrain - - screen.blit(ball_image, (ball_pos[0] - BALL_RADIUS, ball_pos[1] - BALL_RADIUS)) # La balle - - screen.blit(player_image, (player_pos[0], player_pos[1])) # Le joueur - - text = font.render("Score: " + str(score), True, WHITE) - text_rect = text.get_rect() - text_rect.center = (WIDTH // 2, 20) - screen.blit(text, text_rect) # Le text - - - #_____________ Ne rien mettre en dessous _____________ - pygame.display.flip() - clock.tick(60) - -def game_over_screen(): - screen.fill(BLACK) - perdu_text = font.render("Perdu", True, WHITE) - perdu_text_rect = perdu_text.get_rect() - perdu_text_rect.centerx = WIDTH // 2 - perdu_text_rect.centery = HEIGHT // 2 - screen.blit(perdu_text, perdu_text_rect) - pygame.display.flip() - pygame.time.wait(3000) - -# Boucle principale -running = True -while running: - score = 0 - game_over = game() - print(game_over) - if game_over == False: - game_over_screen() - running = False - -pygame.quit() diff --git a/jeu V4.py b/jeu V4.py deleted file mode 100644 index 049090c..0000000 --- a/jeu V4.py +++ /dev/null @@ -1,180 +0,0 @@ -import pygame -import random -import sys - -pygame.init() - -# Paramètres de l'écran -WIDTH = 800 -HEIGHT = 600 - -# Paramètres de couleurs -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) - -# Paramètres de la balle -BALL_WIDTH = 50 -BALL_HEIGHT = 50 -BALL_RADIUS = 50//2 - -# Paramètres du joueur -PLAYER_WIDTH = 80 -PLAYER_HEIGHT = 80 - -# Paramètres du coeur -COEUR_WIDTH = 75 -COEUR_HEIGHT = COEUR_WIDTH*(440/512) -nbcoeur = 1 - -# Images choisies -player_image = pygame.image.load("V4/joueur.png") -player_image = pygame.transform.scale(player_image, (PLAYER_WIDTH, PLAYER_HEIGHT)) # Au cas où l'image fait pas la bonne taille - -ball_image = pygame.image.load("V4/balle.png") -ball_image = pygame.transform.scale(ball_image, (BALL_WIDTH, BALL_HEIGHT)) - -coeur_image = pygame.image.load("V4/coeur.png") -coeur_image = pygame.transform.scale(coeur_image, (COEUR_WIDTH, COEUR_HEIGHT)) -coeurfaded_image = pygame.image.load("V4/coeurfaded.png") -coeurfaded_image = pygame.transform.scale(coeurfaded_image, (COEUR_WIDTH, COEUR_HEIGHT)) - -background_image = pygame.image.load("V4/terrain.png") -background_image = pygame.transform.scale(background_image, (WIDTH, HEIGHT)) - -# Définir les dimensions et la position du rectangle -largeur_rectangle = 150 -hauteur_rectangle = 40 -x_rectangle = (WIDTH - largeur_rectangle) // 2 # Au milieu horizontalement -y_rectangle = 0 # En haut de l'écran - -# Variables du jeu -score = 0 -font = pygame.font.Font(None, 36) -dercolsol = 0 - - -# Initialisation de l'écran de jeu -screen = pygame.display.set_mode((WIDTH, HEIGHT)) -pygame.display.set_caption("Jeu V4") - - -def game(): - global score, nbcoeur - - # Position initiale de la balle - ball_pos = [WIDTH // 2, BALL_RADIUS] - ball_velocity_y = 0 - ball_velocity_x = 1 - gravity = 0.1 - - # Position initiale du joueur - player_pos = [WIDTH // 2 - PLAYER_WIDTH // 2, HEIGHT - PLAYER_HEIGHT - 60] - - nbcoeur = 1 - clock = pygame.time.Clock() - running = True - dercolsol = 0 - - while running: - for event in pygame.event.get(): - if event.type == pygame.QUIT: - pygame.quit() - sys.exit() - - # Gestion des mouvements du joueur - mouse_pos = pygame.mouse.get_pos() - player_pos[0] = mouse_pos[0] - PLAYER_WIDTH // 2 - - # Mise à jour de la logique du jeu - ball_velocity_y += gravity - ball_pos[1] += ball_velocity_y - - # Si la balle touche le joueur - if ball_pos[1] + BALL_RADIUS >= player_pos[1] and ball_pos[0] >= player_pos[0] and ball_pos[0] <= player_pos[0] + PLAYER_WIDTH: - ball_pos[1] = player_pos[1] - BALL_RADIUS - ball_velocity_y = -ball_velocity_y - score += 1 - ball_velocity_x += random.uniform(-3, 3) - print("Score :", score) - - # Si la balle touche le sol - if ball_pos[1] + BALL_RADIUS >= HEIGHT: - current_time = pygame.time.get_ticks() - if current_time - dercolsol >= 1000 : - if nbcoeur >= 1: - nbcoeur -= 1 # Décrémenter le nombre de vies - dercolsol = current_time - ball_velocity_y = -ball_velocity_y - - else: - print(nbcoeur) - return False - pass - - if current_time - dercolsol <= 1000: - print(nbcoeur) - - else: - nbcoeur = nbcoeur - print(nbcoeur) - - # Si la balle touche le plafond - elif ball_pos[1] <= BALL_RADIUS: - ball_pos[1] = BALL_RADIUS - ball_velocity_y = -ball_velocity_y - - ball_pos[0] += ball_velocity_x - - # Si la balle touche les murs - if ball_pos[0] <= BALL_RADIUS or ball_pos[0]+BALL_RADIUS//2 >= WIDTH: - ball_velocity_x = -ball_velocity_x - - # Dessiner les éléments - screen.blit(background_image, (0, 0)) # Le terrain - - screen.blit(ball_image, (ball_pos[0] - BALL_RADIUS, ball_pos[1] - BALL_RADIUS)) # La balle - - screen.blit(player_image, (player_pos[0], player_pos[1])) # Le joueur - - # Afficher le nombre de coeur(s) - if nbcoeur == 1 : - screen.blit(coeur_image, (25, 25)) # Le coeur - - if nbcoeur == 0: - screen.blit(coeurfaded_image, (25,25)) # Le coeur plus transparent - - # Afficher le score - pygame.draw.rect(screen, BLACK, (x_rectangle, y_rectangle, largeur_rectangle, hauteur_rectangle)) - - text = font.render("Score: " + str(score), True, WHITE) - text_rect = text.get_rect() - text_rect.center = (WIDTH // 2, 20) - screen.blit(text, text_rect) # Le score - - #_____________ Ne rien mettre en dessous _____________ - pygame.display.flip() - clock.tick(60) - -def game_over_screen(): - screen.fill(BLACK) - perdu_text = font.render("Perdu", True, WHITE) - perdu_text_rect = perdu_text.get_rect() - perdu_text_rect.centerx = WIDTH // 2 - perdu_text_rect.centery = HEIGHT // 2 - screen.blit(perdu_text, perdu_text_rect) - pygame.display.flip() - pygame.time.wait(3000) - -# Boucle principale -running = True -while running: - score = 0 - nbcoeur = 1 - dercolsol = 0 - game_over = game() - print(game_over) - if game_over == False: - game_over_screen() - running = False - -pygame.quit() diff --git a/jeu V5.5.py b/jeu V5.5.py deleted file mode 100644 index 1d3197d..0000000 --- a/jeu V5.5.py +++ /dev/null @@ -1,255 +0,0 @@ -import pygame -import random -import sys -from pygame.locals import * - -pygame.init() - -# Paramètres de l'écran -WIDTH = 800 -HEIGHT = 600 - -# Paramètres de couleurs -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) -GRIS = (111, 111, 111) # pas sûr de la valeur mdrr - -# Paramètres de la balle -BALL_WIDTH = 50 -BALL_HEIGHT = 50 -BALL_RADIUS = 50//2 - -# Paramètres du joueur -PLAYER_WIDTH = 80 -PLAYER_HEIGHT = 80 - -# Paramètres des sprites -SPRITE_WIDTH = 80 -SPRITE_HEIGHT = 80 - -# Paramètres du coeur -COEUR_WIDTH = 75 -COEUR_HEIGHT = COEUR_WIDTH*(440/512) -nbcoeur = 1 - -# Images choisies -player_image = pygame.transform.scale(pygame.image.load("V5/joueur.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) # Au cas où l'image fait pas la bonne taille - -ball_image = pygame.transform.scale(pygame.image.load("V5/balle.png"), (BALL_WIDTH, BALL_HEIGHT)) - -coeur_image = pygame.transform.scale(pygame.image.load("V5/coeur.png"), (COEUR_WIDTH, COEUR_HEIGHT)) -coeurfaded_image = pygame.transform.scale(pygame.image.load("V5/coeurfaded.png"), (COEUR_WIDTH, COEUR_HEIGHT)) - -background_image = pygame.transform.scale(pygame.image.load("V5/terrain.png"), (WIDTH, HEIGHT)) - - -listex = [110, 230, 350, 470, 590, 110, 230, 350, 470, 590] -listey = [190, 190, 190, 190, 190, 310, 310, 310, 310, 310] - -sprites = [] # Liste pour stocker les sprites -sprite_rects = [] # Liste pour stocker les rectangles englobants des sprites -selected_sprite = None # Le sprite choisi - -# Charger les 10 sprites -for i in range(10): - sprite_image = pygame.transform.scale(pygame.image.load(f"V5.5/{i+1}.png"), (SPRITE_WIDTH, SPRITE_HEIGHT)) - sprites.append(sprite_image) - sprite_rect = sprite_image.get_rect() - sprite_rect.topleft = (listex[i], listey[i]) # Définir les coordonnées du sprite - sprite_rects.append(sprite_rect) - -# Définir les dimensions et la position du rectangle pour le score -largeur_rectangle = 150 -hauteur_rectangle = 40 -x_rectangle = (WIDTH - largeur_rectangle) // 2 # Au milieu horizontalement -y_rectangle = 0 # En haut de l'écran - -# Variables du jeu -score = 0 -font = pygame.font.Font(None, 36) -dercolsol = 0 -nbrotation = 0 - -# Initialisation de l'écran de jeu -screen = pygame.display.set_mode((WIDTH, HEIGHT)) -pygame.display.set_caption("Jeu V5.5") - - -def start_screen(): - selected_sprite = None - screen.fill(BLACK) - start_text = font.render("Appuyez sur une touche pour commencer", True, WHITE) - start_text_rect = start_text.get_rect() - start_text_rect.centerx = WIDTH // 2 - start_text_rect.centery = HEIGHT // 5 - screen.blit(start_text, start_text_rect) - for i, sprite in enumerate(sprites): - screen.blit(sprite, sprite_rects[i]) - pygame.display.flip() - - while True: - for event in pygame.event.get(): - if event.type == KEYDOWN: - return selected_sprite - - elif event.type == MOUSEBUTTONDOWN and event.button == 1: # Clic gauche de la souris - print("L'utilisateur a cliqué") - mouse_pos = pygame.mouse.get_pos() - - if start_text_rect.collidepoint(mouse_pos): - print("L'utilisateur a cliqué sur le texte de départ.") - - for i, sprite_rect in enumerate(sprite_rects): - if sprite_rect.collidepoint(mouse_pos): - print(f"L'utilisateur a cliqué sur le sprite {i+1}.") - selected_sprite = i - - screen.fill(BLACK) # Effacer l'écran - screen.blit(start_text, start_text_rect) - - # Dessiner les sprites à l'écran - for i, sprite in enumerate(sprites): - screen.blit(sprite, sprite_rects[i]) - - # Dessiner le rectangle autour du sprite sélectionné - if selected_sprite is not None and selected_sprite == i: - pygame.draw.rect(screen, GRIS, sprite_rects[i], 2) - - pygame.display.flip() - -def game(i): - global score, nbcoeur - - if i != 0: - player_image = pygame.transform.scale(pygame.image.load(f"V5.5/{i+1}.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) - else: - i = 0 - player_image = pygame.transform.scale(pygame.image.load(f"V5.5/{i+1}.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) - - # Position initiale de la balle - ball_pos = [WIDTH // 2, BALL_RADIUS] - ball_velocity_y = 0 - ball_velocity_x = 1 - gravity = 0.1 - - # Position initiale du joueur - player_pos = [WIDTH // 2 - PLAYER_WIDTH // 2, HEIGHT - PLAYER_HEIGHT - 60] - - nbcoeur = 1 - clock = pygame.time.Clock() - running = True - dercolsol = 0 - nbrotation = 0 - while running: - for event in pygame.event.get(): - if event.type == pygame.QUIT: - pygame.quit() - sys.exit() - - # Gestion des mouvements du joueur - mouse_pos = pygame.mouse.get_pos() - player_pos[0] = mouse_pos[0] - PLAYER_WIDTH // 2 - - # Mise à jour de la logique du jeu - ball_velocity_y += gravity - ball_pos[1] += ball_velocity_y - - # Si la balle touche le joueur - if ball_pos[1] + BALL_RADIUS >= player_pos[1] and ball_pos[0] >= player_pos[0] and ball_pos[0] <= player_pos[0] + PLAYER_WIDTH: - ball_pos[1] = player_pos[1] - BALL_RADIUS - ball_velocity_y = -ball_velocity_y - score += 1 - ball_velocity_x += random.uniform(-3, 3) - print("Score :", score) - nbrotation+=5 - - # Si la balle touche le sol - if ball_pos[1] + BALL_RADIUS >= HEIGHT: - current_time = pygame.time.get_ticks() - if current_time - dercolsol >= 1000 : - if nbcoeur >= 1: - nbcoeur -= 1 # Décrémenter le nombre de vies - dercolsol = current_time - ball_velocity_y = -ball_velocity_y - nbrotation+=5 - - - else: - print(nbcoeur) - return False - pass - - if current_time - dercolsol <= 1000: - print(nbcoeur) - - else: - nbcoeur = nbcoeur - print(nbcoeur) - - # Si la balle touche le plafond - elif ball_pos[1] <= BALL_RADIUS: - ball_pos[1] = BALL_RADIUS - ball_velocity_y = -ball_velocity_y - nbrotation+=5 - - ball_pos[0] += ball_velocity_x - - # Si la balle touche les murs - if ball_pos[0] <= BALL_RADIUS or ball_pos[0]+BALL_RADIUS//2 >= WIDTH: - ball_velocity_x = -ball_velocity_x - nbrotation+=5 - - # Dessiner les éléments - screen.blit(background_image, (0, 0)) # Le terrain - - nbrotation+=1 - screen.blit(pygame.transform.rotate(ball_image, nbrotation), (ball_pos[0] - BALL_RADIUS, ball_pos[1] - BALL_RADIUS)) # La balle - - screen.blit(player_image, (player_pos[0], player_pos[1])) # Le joueur - - # Afficher le nombre de coeur(s) - if nbcoeur == 1 : - screen.blit(coeur_image, (25, 25)) # Le coeur - - if nbcoeur == 0: - screen.blit(coeurfaded_image, (25,25)) # Le coeur plus transparent - - # Afficher le score - pygame.draw.rect(screen, BLACK, (x_rectangle, y_rectangle, largeur_rectangle, hauteur_rectangle)) - - text = font.render("Score : " + str(score), True, WHITE) - text_rect = text.get_rect() - text_rect.center = (WIDTH // 2, 20) - screen.blit(text, text_rect) # Le score - - #_____________ Ne rien mettre en dessous _____________ - pygame.display.flip() - clock.tick(60) - -def game_over_screen(): - screen.fill(BLACK) - perdu_text = font.render("Perdu", True, WHITE) - perdu_text_rect = perdu_text.get_rect() - perdu_text_rect.centerx = WIDTH // 2 - perdu_text_rect.centery = HEIGHT // 2 - screen.blit(perdu_text, perdu_text_rect) - pygame.display.flip() - pygame.time.wait(3000) - -# Boucle principale -running = True -while running: - selected_sprite = None - selected_skin = start_screen() - print('le skin choisi est :', selected_skin) - score = 0 - nbcoeur = 1 - dercolsol = 0 - nbrotation = 0 - game_over = game(selected_skin) - print(game_over) - if game_over == False: - game_over_screen() - running = False - -pygame.quit() diff --git a/jeu V5.6.py b/jeu V5.6.py deleted file mode 100644 index 2c4e7c7..0000000 --- a/jeu V5.6.py +++ /dev/null @@ -1,275 +0,0 @@ -import pygame -import random -import sys -from pygame.locals import * - -pygame.init() - -# Paramètres de l'écran -WIDTH = 800 -HEIGHT = 600 - -# Paramètres de couleurs -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) -GRIS = (111, 111, 111) # pas sûr de la valeur mdrr - -# Paramètres de la balle -BALL_WIDTH = 50 -BALL_HEIGHT = 50 -BALL_RADIUS = 50//2 - -# Paramètres du joueur -PLAYER_WIDTH = 80 -PLAYER_HEIGHT = 80 - -# Paramètres des sprites -SPRITE_WIDTH = 80 -SPRITE_HEIGHT = 80 - -# Paramètres du coeur -COEUR_WIDTH = 75 -COEUR_HEIGHT = COEUR_WIDTH*(440/512) -nbcoeur = 1 - -# Paramètre du smiley -SMILEY_WIDTH = 300 -SMILEY_HEIGHT = SMILEY_WIDTH - -# Images choisies -player_image = pygame.transform.scale(pygame.image.load("V5.6/joueur.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) # Au cas où l'image fait pas la bonne taille - -ball_image = pygame.transform.scale(pygame.image.load("V5.6/balle.png"), (BALL_WIDTH, BALL_HEIGHT)) - -coeur_image = pygame.transform.scale(pygame.image.load("V5.6/coeur.png"), (COEUR_WIDTH, COEUR_HEIGHT)) -coeurfaded_image = pygame.transform.scale(pygame.image.load("V5.6/coeurfaded.png"), (COEUR_WIDTH, COEUR_HEIGHT)) - -smiley_image = pygame.transform.scale(pygame.image.load("V5.6/smiley.png"), (SMILEY_WIDTH, SMILEY_HEIGHT)) - -background_image = pygame.transform.scale(pygame.image.load("V5.6/terrain.png"), (WIDTH, HEIGHT)) - -pygame.display.set_icon(ball_image) - -listex = [110, 230, 350, 470, 590, 110, 230, 350, 470, 590] -listey = [190, 190, 190, 190, 190, 310, 310, 310, 310, 310] - -sprites = [] # Liste pour stocker les sprites -sprite_rects = [] # Liste pour stocker les rectangles englobants des sprites -selected_sprite = None # Le sprite choisi - -# Charger les 10 sprites -for i in range(10): - sprite_image = pygame.transform.scale(pygame.image.load(f"V5.6/{i+1}.png"), (SPRITE_WIDTH, SPRITE_HEIGHT)) - sprites.append(sprite_image) - sprite_rect = sprite_image.get_rect() - sprite_rect.topleft = (listex[i], listey[i]) # Définir les coordonnées du sprite - sprite_rects.append(sprite_rect) - -# Charger une musique parmis la super compilation -i = random.randint(0, 16) -path = 'V5.6/output_folder/mp3/' -musique = path + str(i) + '.mp3' -pygame.mixer.music.load(musique) - - - -# Définir les dimensions et la position du rectangle pour le score -largeur_rectangle = 150 -hauteur_rectangle = 40 -x_rectangle = (WIDTH - largeur_rectangle) // 2 # Au milieu horizontalement -y_rectangle = 0 # En haut de l'écran - -# Variables du jeu -score = 0 -font = pygame.font.Font(None, 36) -dercolsol = 0 -nbrotation = 0 - -# Initialisation de l'écran de jeu -screen = pygame.display.set_mode((WIDTH, HEIGHT)) -pygame.display.set_caption("Jeu V5.6") - - -def start_screen(): - selected_sprite = None - screen.fill(BLACK) - start_text = font.render("Appuyez sur une touche pour commencer", True, WHITE) - start_text_rect = start_text.get_rect() - start_text_rect.centerx = WIDTH // 2 - start_text_rect.centery = HEIGHT // 5 - screen.blit(start_text, start_text_rect) - for i, sprite in enumerate(sprites): - screen.blit(sprite, sprite_rects[i]) - pygame.display.flip() - - while True: - for event in pygame.event.get(): - if event.type == KEYDOWN: - return selected_sprite - - elif event.type == MOUSEBUTTONDOWN and event.button == 1: # Clic gauche de la souris - # print("L'utilisateur a cliqué") - mouse_pos = pygame.mouse.get_pos() - - if start_text_rect.collidepoint(mouse_pos): - print("L'utilisateur a cliqué sur le texte de départ.") - - for i, sprite_rect in enumerate(sprite_rects): - if sprite_rect.collidepoint(mouse_pos): - print(f"L'utilisateur a cliqué sur le sprite {i+1}.") - selected_sprite = i - - screen.fill(BLACK) # Effacer l'écran - screen.blit(start_text, start_text_rect) - - # Dessiner les sprites à l'écran - for i, sprite in enumerate(sprites): - screen.blit(sprite, sprite_rects[i]) - - # Dessiner le rectangle autour du sprite sélectionné - if selected_sprite is not None and selected_sprite == i: - pygame.draw.rect(screen, GRIS, sprite_rects[i], 2) - - pygame.display.flip() - -def game(i): - global score, nbcoeur - - if i != None: - player_image = pygame.transform.scale(pygame.image.load(f"V5.6/{i+1}.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) - else: - i = 0 - player_image = pygame.transform.scale(pygame.image.load(f"V5.6/{i+1}.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) - - # Position initiale de la balle - ball_pos = [WIDTH // 2, BALL_RADIUS] - ball_velocity_y = 0 - ball_velocity_x = 1 - gravity = 0.1 - - # Position initiale du joueur - player_pos = [WIDTH // 2 - PLAYER_WIDTH // 2, HEIGHT - PLAYER_HEIGHT - 60] - - nbcoeur = 1 - clock = pygame.time.Clock() - running = True - dercolsol = 0 - nbrotation = 0 - while running: - for event in pygame.event.get(): - if event.type == pygame.QUIT: - pygame.quit() - sys.exit() - - # Gestion des mouvements du joueur - mouse_pos = pygame.mouse.get_pos() - player_pos[0] = mouse_pos[0] - PLAYER_WIDTH // 2 - - # Mise à jour de la logique du jeu - ball_velocity_y += gravity - ball_pos[1] += ball_velocity_y - - # Si la balle touche le joueur - if ball_pos[1] + BALL_RADIUS >= player_pos[1] and ball_pos[0] >= player_pos[0] and ball_pos[0] <= player_pos[0] + PLAYER_WIDTH: - ball_pos[1] = player_pos[1] - BALL_RADIUS - ball_velocity_y = -ball_velocity_y - score += 1 - ball_velocity_x += random.uniform(-3, 3) - print("Score :", score) - nbrotation+=5 - - # Si la balle touche le sol - if ball_pos[1] + BALL_RADIUS >= HEIGHT: - current_time = pygame.time.get_ticks() - if current_time - dercolsol >= 1000 : - if nbcoeur >= 1: - nbcoeur -= 1 # Décrémenter le nombre de vies - dercolsol = current_time - ball_velocity_y = -ball_velocity_y - nbrotation+=5 - - - else: - print(nbcoeur) - return False - pass - - if current_time - dercolsol <= 1000: - print(nbcoeur) - - else: - nbcoeur = nbcoeur - print(nbcoeur) - - # Si la balle touche le plafond - elif ball_pos[1] <= BALL_RADIUS: - ball_pos[1] = BALL_RADIUS - ball_velocity_y = -ball_velocity_y - nbrotation+=5 - - ball_pos[0] += ball_velocity_x - - # Si la balle touche les murs - if ball_pos[0] <= BALL_RADIUS or ball_pos[0]+BALL_RADIUS//2 >= WIDTH: - ball_velocity_x = -ball_velocity_x - nbrotation+=5 - - # Dessiner les éléments - screen.blit(background_image, (0, 0)) # Le terrain - - nbrotation+=1 - screen.blit(pygame.transform.rotate(ball_image, nbrotation), (ball_pos[0] - BALL_RADIUS, ball_pos[1] - BALL_RADIUS)) # La balle - - screen.blit(player_image, (player_pos[0], player_pos[1])) # Le joueur - - # Afficher le nombre de coeur(s) - if nbcoeur == 1 : - screen.blit(coeur_image, (25, 25)) # Le coeur - - if nbcoeur == 0: - screen.blit(coeurfaded_image, (25,25)) # Le coeur plus transparent - - # Afficher le score - pygame.draw.rect(screen, BLACK, (x_rectangle, y_rectangle, largeur_rectangle, hauteur_rectangle)) - - text = font.render("Score : " + str(score), True, WHITE) - text_rect = text.get_rect() - text_rect.center = (WIDTH // 2, 20) - screen.blit(text, text_rect) # Le score - - #_____________ Ne rien mettre en dessous _____________ - pygame.display.flip() - clock.tick(60) - -def game_over_screen(): - screen.fill(BLACK) - perdu_text = font.render("Perdu", True, WHITE) - perdu_text_rect = perdu_text.get_rect() - perdu_text_rect.centerx = WIDTH // 2 - perdu_text_rect.centery = HEIGHT // 5 - screen.blit(perdu_text, perdu_text_rect) - - screen.blit(smiley_image, ((WIDTH // 2)-SMILEY_WIDTH/2, (HEIGHT // 2)-SPRITE_HEIGHT/2)) # Le smiley - - pygame.display.flip() - pygame.time.wait(3000) - - -# Boucle principale -running = True -while running: - pygame.mixer.music.play() - selected_sprite = None - selected_skin = start_screen() - print('le skin choisi est :', selected_skin) - score = 0 - nbcoeur = 1 - dercolsol = 0 - nbrotation = 0 - game_over = game(selected_skin) - print(game_over) - if game_over == False: - game_over_screen() - running = False - -pygame.quit() diff --git a/jeu V5.py b/jeu V5.py deleted file mode 100644 index b0b36bb..0000000 --- a/jeu V5.py +++ /dev/null @@ -1,188 +0,0 @@ -import pygame -import random -import sys - -pygame.init() - -# Paramètres de l'écran -WIDTH = 800 -HEIGHT = 600 - -# Paramètres de couleurs -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) - -# Paramètres de la balle -BALL_WIDTH = 50 -BALL_HEIGHT = 50 -BALL_RADIUS = 50//2 - -# Paramètres du joueur -PLAYER_WIDTH = 80 -PLAYER_HEIGHT = 80 - -# Paramètres du coeur -COEUR_WIDTH = 75 -COEUR_HEIGHT = COEUR_WIDTH*(440/512) -nbcoeur = 1 - -# Images choisies -player_image = pygame.image.load("V5/joueur.png") -player_image = pygame.transform.scale(player_image, (PLAYER_WIDTH, PLAYER_HEIGHT)) # Au cas où l'image fait pas la bonne taille - -ball_image = pygame.image.load("V5/balle.png") -ball_image = pygame.transform.scale(ball_image, (BALL_WIDTH, BALL_HEIGHT)) - -coeur_image = pygame.image.load("V5/coeur.png") -coeur_image = pygame.transform.scale(coeur_image, (COEUR_WIDTH, COEUR_HEIGHT)) -coeurfaded_image = pygame.image.load("V5/coeurfaded.png") -coeurfaded_image = pygame.transform.scale(coeurfaded_image, (COEUR_WIDTH, COEUR_HEIGHT)) - -background_image = pygame.image.load("V5/terrain.png") -background_image = pygame.transform.scale(background_image, (WIDTH, HEIGHT)) - -# Définir les dimensions et la position du rectangle -largeur_rectangle = 150 -hauteur_rectangle = 40 -x_rectangle = (WIDTH - largeur_rectangle) // 2 # Au milieu horizontalement -y_rectangle = 0 # En haut de l'écran - -# Variables du jeu -score = 0 -font = pygame.font.Font(None, 36) -dercolsol = 0 -nbrotation = 0 - - -# Initialisation de l'écran de jeu -screen = pygame.display.set_mode((WIDTH, HEIGHT)) -pygame.display.set_caption("Jeu V5") - - -def game(): - global score, nbcoeur - - # Position initiale de la balle - ball_pos = [WIDTH // 2, BALL_RADIUS] - ball_velocity_y = 0 - ball_velocity_x = 1 - gravity = 0.1 - - # Position initiale du joueur - player_pos = [WIDTH // 2 - PLAYER_WIDTH // 2, HEIGHT - PLAYER_HEIGHT - 60] - - nbcoeur = 1 - clock = pygame.time.Clock() - running = True - dercolsol = 0 - nbrotation = 0 - while running: - for event in pygame.event.get(): - if event.type == pygame.QUIT: - pygame.quit() - sys.exit() - - # Gestion des mouvements du joueur - mouse_pos = pygame.mouse.get_pos() - player_pos[0] = mouse_pos[0] - PLAYER_WIDTH // 2 - - # Mise à jour de la logique du jeu - ball_velocity_y += gravity - ball_pos[1] += ball_velocity_y - - # Si la balle touche le joueur - if ball_pos[1] + BALL_RADIUS >= player_pos[1] and ball_pos[0] >= player_pos[0] and ball_pos[0] <= player_pos[0] + PLAYER_WIDTH: - ball_pos[1] = player_pos[1] - BALL_RADIUS - ball_velocity_y = -ball_velocity_y - score += 1 - ball_velocity_x += random.uniform(-3, 3) - print("Score :", score) - nbrotation+=5 - - # Si la balle touche le sol - if ball_pos[1] + BALL_RADIUS >= HEIGHT: - current_time = pygame.time.get_ticks() - if current_time - dercolsol >= 1000 : - if nbcoeur >= 1: - nbcoeur -= 1 # Décrémenter le nombre de vies - dercolsol = current_time - ball_velocity_y = -ball_velocity_y - nbrotation+=5 - - - else: - print(nbcoeur) - return False - pass - - if current_time - dercolsol <= 1000: - print(nbcoeur) - - else: - nbcoeur = nbcoeur - print(nbcoeur) - - # Si la balle touche le plafond - elif ball_pos[1] <= BALL_RADIUS: - ball_pos[1] = BALL_RADIUS - ball_velocity_y = -ball_velocity_y - nbrotation+=5 - - ball_pos[0] += ball_velocity_x - - # Si la balle touche les murs - if ball_pos[0] <= BALL_RADIUS or ball_pos[0]+BALL_RADIUS//2 >= WIDTH: - ball_velocity_x = -ball_velocity_x - nbrotation+=5 - - # Dessiner les éléments - screen.blit(background_image, (0, 0)) # Le terrain - - nbrotation+=1 - screen.blit(pygame.transform.rotate(ball_image, nbrotation), (ball_pos[0] - BALL_RADIUS, ball_pos[1] - BALL_RADIUS)) # La balle - - screen.blit(player_image, (player_pos[0], player_pos[1])) # Le joueur - - # Afficher le nombre de coeur(s) - if nbcoeur == 1 : - screen.blit(coeur_image, (25, 25)) # Le coeur - - if nbcoeur == 0: - screen.blit(coeurfaded_image, (25,25)) # Le coeur plus transparent - - # Afficher le score - pygame.draw.rect(screen, BLACK, (x_rectangle, y_rectangle, largeur_rectangle, hauteur_rectangle)) - - text = font.render("Score : " + str(score), True, WHITE) - text_rect = text.get_rect() - text_rect.center = (WIDTH // 2, 20) - screen.blit(text, text_rect) # Le score - - #_____________ Ne rien mettre en dessous _____________ - pygame.display.flip() - clock.tick(60) - -def game_over_screen(): - screen.fill(BLACK) - perdu_text = font.render("Perdu", True, WHITE) - perdu_text_rect = perdu_text.get_rect() - perdu_text_rect.centerx = WIDTH // 2 - perdu_text_rect.centery = HEIGHT // 2 - screen.blit(perdu_text, perdu_text_rect) - pygame.display.flip() - pygame.time.wait(3000) - -# Boucle principale -running = True -while running: - score = 0 - nbcoeur = 1 - dercolsol = 0 - nbrotation = 0 - game_over = game() - print(game_over) - if game_over == False: - game_over_screen() - running = False - -pygame.quit() diff --git a/jeu V6.py b/jeu V6.py deleted file mode 100644 index 3f3b9e0..0000000 --- a/jeu V6.py +++ /dev/null @@ -1,345 +0,0 @@ -import pygame -import random -import sys -from pygame.locals import * - -pygame.init() - -# Paramètres de l'écran -WIDTH = 800 -HEIGHT = 600 - -# Paramètres de couleurs -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) -GRIS = (111, 111, 111) # pas sûr de la valeur mdrr - -# Paramètres de la balle -BALL_WIDTH = 50 -BALL_HEIGHT = 50 -BALL_RADIUS = 50//2 - -# Paramètres du joueur -PLAYER_WIDTH = 80 -PLAYER_HEIGHT = 80 - -# Paramètres des sprites -SPRITE_WIDTH = 80 -SPRITE_HEIGHT = 80 - -# Paramètres du coeur -COEUR_WIDTH = 75 -COEUR_HEIGHT = COEUR_WIDTH*(440/512) -nbcoeur = 1 - -# Paramètre du smiley -SMILEY_WIDTH = 300 -SMILEY_HEIGHT = SMILEY_WIDTH - -# Images choisies -player_image = pygame.transform.scale(pygame.image.load("V5.6/joueur.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) # Au cas où l'image fait pas la bonne taille - -ball_image = pygame.transform.scale(pygame.image.load("V5.6/balle.png"), (BALL_WIDTH, BALL_HEIGHT)) - -coeur_image = pygame.transform.scale(pygame.image.load("V5.6/coeur.png"), (COEUR_WIDTH, COEUR_HEIGHT)) -coeurfaded_image = pygame.transform.scale(pygame.image.load("V5.6/coeurfaded.png"), (COEUR_WIDTH, COEUR_HEIGHT)) - -smiley_image = pygame.transform.scale(pygame.image.load("V5.6/smiley.png"), (SMILEY_WIDTH, SMILEY_HEIGHT)) - -background_image = pygame.transform.scale(pygame.image.load("V5.6/terrain.png"), (WIDTH, HEIGHT)) - -pygame.display.set_icon(ball_image) - -listex = [110, 230, 350, 470, 590, 110, 230, 350, 470, 590] -listey = [190, 190, 190, 190, 190, 310, 310, 310, 310, 310] - -sprites = [] # Liste pour stocker les sprites -sprite_rects = [] # Liste pour stocker les rectangles englobants des sprites -selected_sprite = None # Le sprite choisi - -# Charger les 10 sprites -for i in range(10): - sprite_image = pygame.transform.scale(pygame.image.load(f"V5.6/{i+1}.png"), (SPRITE_WIDTH, SPRITE_HEIGHT)) - sprites.append(sprite_image) - sprite_rect = sprite_image.get_rect() - sprite_rect.topleft = (listex[i], listey[i]) # Définir les coordonnées du sprite - sprite_rects.append(sprite_rect) - -# Charger une musique parmis la super compilation -i = random.randint(0, 16) -path = 'V5.6/output_folder/mp3/' -musique = path + str(i) + '.mp3' -pygame.mixer.music.load(musique) - - - -# Définir les dimensions et la position du rectangle pour le score -largeur_rectangle = 150 -hauteur_rectangle = 40 -x_rectangle = (WIDTH - largeur_rectangle) // 2 # Au milieu horizontalement -y_rectangle = 0 # En haut de l'écran - -# Variables du jeu -score = 0 -font = pygame.font.Font(None, 36) -dercolsol = 0 -nbrotation = 0 - -# Initialisation de l'écran de jeu -screen = pygame.display.set_mode((WIDTH, HEIGHT)) -pygame.display.set_caption("Jeu V5.6") - - -def start_screen(): - selected_sprite = None - screen.fill(BLACK) - - for i, sprite in enumerate(sprites): - screen.blit(sprite, sprite_rects[i]) - pygame.display.flip() - - while True: - for event in pygame.event.get(): - if event.type == KEYDOWN: - return selected_sprite - - elif event.type == MOUSEBUTTONDOWN and event.button == 1: # Clic gauche de la souris - # print("L'utilisateur a cliqué") - mouse_pos = pygame.mouse.get_pos() - - for i, sprite_rect in enumerate(sprite_rects): - if sprite_rect.collidepoint(mouse_pos): - print(f"L'utilisateur a cliqué sur le sprite {i+1}.") - selected_sprite = i - - screen.fill(BLACK) # Effacer l'écran - - # Dessiner les sprites à l'écran - for i, sprite in enumerate(sprites): - screen.blit(sprite, sprite_rects[i]) - - # Dessiner le rectangle autour du sprite sélectionné - if selected_sprite is not None and selected_sprite == i: - pygame.draw.rect(screen, GRIS, sprite_rects[i], 2) - - - police = pygame.font.Font(None, 24) - texte = "Choisissez le skin de votre choix avec la souris\nAppuyer sur n'importe quelle touche pour commencer la partie\nBonne chance !" - lignes = texte.split("\n") # Diviser le texte en lignes - y = 50 # Position y initiale du texte - - for ligne in lignes: - y += 30 # Augmenter la position y pour la prochaine ligne - - text = font.render(ligne, True, WHITE) - text_rect = text.get_rect() - text_rect.center = (WIDTH // 2, y) - screen.blit(text, text_rect) # Le score - - pygame.display.flip() - -def game(i): - global score, nbcoeur - - if i != None: - player_image = pygame.transform.scale(pygame.image.load(f"V5.6/{i+1}.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) - else: - i = 0 - player_image = pygame.transform.scale(pygame.image.load(f"V5.6/{i+1}.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) - - # Position initiale de la balle - ball_pos = [WIDTH // 2, BALL_RADIUS] - ball_velocity_y = 0 - ball_velocity_x = 1 - gravity = 0.1 - - # Position initiale du joueur - player_pos = [WIDTH // 2 - PLAYER_WIDTH // 2, HEIGHT - PLAYER_HEIGHT - 60] - - nbcoeur = 1 - clock = pygame.time.Clock() - running = True - dercolsol = 0 - nbrotation = 0 - while running: - for event in pygame.event.get(): - if event.type == pygame.QUIT: - pygame.quit() - sys.exit() - - # Gestion des mouvements du joueur - mouse_pos = pygame.mouse.get_pos() - player_pos[0] = mouse_pos[0] - PLAYER_WIDTH // 2 - - # Mise à jour de la logique du jeu - ball_velocity_y += gravity - ball_pos[1] += ball_velocity_y - - # Si la balle touche le joueur - if ball_pos[1] + BALL_RADIUS >= player_pos[1] and ball_pos[0] >= player_pos[0] and ball_pos[0] <= player_pos[0] + PLAYER_WIDTH: - ball_pos[1] = player_pos[1] - BALL_RADIUS - ball_velocity_y = -ball_velocity_y - score += 1 - - # gravity+=score//10 - if score%5 == 0: - if score//5<=4: - print('add gravity + :' , (score//5)/10) - gravity += (score//5)/10 - else:print('la gravité est déjà au max') - - ball_velocity_x += random.uniform(-3, 3) - print("Score :", score) - nbrotation+=5 - - # Si la balle touche le sol - if ball_pos[1] + BALL_RADIUS >= HEIGHT: - current_time = pygame.time.get_ticks() - if current_time - dercolsol >= 1000 : - if nbcoeur >= 1: - nbcoeur -= 1 # Décrémenter le nombre de vies - dercolsol = current_time - ball_velocity_y = -ball_velocity_y - nbrotation+=5 - - - else: - print(nbcoeur) - return False - pass - - if current_time - dercolsol <= 1000: - print(nbcoeur) - - else: - nbcoeur = nbcoeur - print(nbcoeur) - - # Si la balle touche le plafond - elif ball_pos[1] <= BALL_RADIUS: - ball_pos[1] = BALL_RADIUS - ball_velocity_y = -ball_velocity_y - nbrotation+=5 - - ball_pos[0] += ball_velocity_x - - # Si la balle touche les murs - if ball_pos[0] <= BALL_RADIUS or ball_pos[0]+BALL_RADIUS//2 >= WIDTH: - ball_velocity_x = -ball_velocity_x - nbrotation+=5 - - # Dessiner les éléments - screen.blit(background_image, (0, 0)) # Le terrain - - nbrotation+=1 - screen.blit(pygame.transform.rotate(ball_image, nbrotation), (ball_pos[0] - BALL_RADIUS, ball_pos[1] - BALL_RADIUS)) # La balle - - screen.blit(player_image, (player_pos[0], player_pos[1])) # Le joueur - - # Afficher le nombre de coeur(s) - if nbcoeur == 1 : - screen.blit(coeur_image, (25, 25)) # Le coeur - - if nbcoeur == 0: - screen.blit(coeurfaded_image, (25,25)) # Le coeur plus transparent - - # Afficher le score - pygame.draw.rect(screen, BLACK, (x_rectangle, y_rectangle, largeur_rectangle, hauteur_rectangle)) - - text = font.render("Score : " + str(score), True, WHITE) - text_rect = text.get_rect() - text_rect.center = (WIDTH // 2, 20) - screen.blit(text, text_rect) # Le score - - #_____________ Ne rien mettre en dessous _____________ - pygame.display.flip() - clock.tick(60) - -def game_over_screen(): - screen.fill(BLACK) - perdu_text = font.render("Perdu", True, WHITE) - perdu_text_rect = perdu_text.get_rect() - perdu_text_rect.centerx = WIDTH // 2 - perdu_text_rect.centery = HEIGHT // 5 - screen.blit(perdu_text, perdu_text_rect) - - screen.blit(smiley_image, ((WIDTH // 2)-SMILEY_WIDTH/2, (HEIGHT // 2)-SPRITE_HEIGHT/2)) # Le smiley - - pygame.display.flip() - # pygame.time.wait(3000) - replay_screen() - - -def replay_screen(): - screen.fill(BLACK) - game_over_text = font.render("Partie terminée", True, WHITE) - game_over_text_rect = game_over_text.get_rect() - game_over_text_rect.centerx = WIDTH // 2 - game_over_text_rect.centery = HEIGHT // 5 - screen.blit(game_over_text, game_over_text_rect) - - replay_button = pygame.Rect(WIDTH // 2 - 100, 250, 200, 50) - pygame.draw.rect(screen, WHITE, replay_button) - replay_text = font.render("Rejouer", True, BLACK) - replay_text_rect = replay_text.get_rect() - replay_text_rect.center = replay_button.center - screen.blit(replay_text, replay_text_rect) - - change_skin_button = pygame.Rect(WIDTH // 2 - 125, 350, 250, 50) - pygame.draw.rect(screen, WHITE, change_skin_button) - change_skin_text = font.render("Changer de skin", True, BLACK) - change_skin_text_rect = change_skin_text.get_rect() - change_skin_text_rect.center = change_skin_button.center - screen.blit(change_skin_text, change_skin_text_rect) - - quit_button = pygame.Rect(WIDTH // 2 - 100, 450, 200, 50) - pygame.draw.rect(screen, WHITE, quit_button) - quit_text = font.render("Quitter", True, BLACK) - quit_text_rect = quit_text.get_rect() - quit_text_rect.center = quit_button.center - screen.blit(quit_text, quit_text_rect) - - - pygame.display.flip() - - while True: - for event in pygame.event.get(): - if event.type == pygame.QUIT: - pygame.quit() - sys.exit() - - if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: - mouse_pos = pygame.mouse.get_pos() - if replay_button.collidepoint(mouse_pos): - return - if change_skin_button.collidepoint(mouse_pos): - return False - if quit_button.collidepoint(mouse_pos): - pygame.quit() - sys.exit() - -# Boucle principale -running = True -selected = False -change = None -while running: - pygame.mixer.music.play() - selected_sprite = None - if not selected: - selected_skin = start_screen() - selected = True - print('le skin choisi est :', selected_skin) - score = 0 - nbcoeur = 1 - dercolsol = 0 - nbrotation = 0 - game_over = game(selected_skin) - print(game_over) - if game_over == False: - change = replay_screen() - print(change) - if change == False: - selected = False - else : pass - -pygame.quit() diff --git a/jeu V7.py b/jeu V7.py index 57a2d5c..7e0507c 100644 --- a/jeu V7.py +++ b/jeu V7.py @@ -4,6 +4,7 @@ import sys from pygame.locals import * import csv from math import * +import os pygame.init() @@ -39,16 +40,16 @@ SMILEY_WIDTH = 150 SMILEY_HEIGHT = SMILEY_WIDTH # Images choisies -player_image = pygame.transform.scale(pygame.image.load("V5.6/joueur.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) # Au cas où l'image fait pas la bonne taille +player_image = pygame.transform.scale(pygame.image.load("assets/joueur.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) # Au cas où l'image fait pas la bonne taille -ball_image = pygame.transform.scale(pygame.image.load("V5.6/balle.png"), (BALL_WIDTH, BALL_HEIGHT)) +ball_image = pygame.transform.scale(pygame.image.load("assets/balle.png"), (BALL_WIDTH, BALL_HEIGHT)) -coeur_image = pygame.transform.scale(pygame.image.load("V5.6/coeur.png"), (COEUR_WIDTH, COEUR_HEIGHT)) -coeurfaded_image = pygame.transform.scale(pygame.image.load("V5.6/coeurfaded.png"), (COEUR_WIDTH, COEUR_HEIGHT)) +coeur_image = pygame.transform.scale(pygame.image.load("assets/coeur.png"), (COEUR_WIDTH, COEUR_HEIGHT)) +coeurfaded_image = pygame.transform.scale(pygame.image.load("assets/coeurfaded.png"), (COEUR_WIDTH, COEUR_HEIGHT)) -smiley_image = pygame.transform.scale(pygame.image.load("V5.6/smiley.png"), (SMILEY_WIDTH, SMILEY_HEIGHT)) +smiley_image = pygame.transform.scale(pygame.image.load("assets/smiley.png"), (SMILEY_WIDTH, SMILEY_HEIGHT)) -background_image = pygame.transform.scale(pygame.image.load("V5.6/terrain.png"), (WIDTH, HEIGHT)) +background_image = pygame.transform.scale(pygame.image.load("assets/terrain.png"), (WIDTH, HEIGHT)) pygame.display.set_icon(ball_image) @@ -61,7 +62,7 @@ selected_sprite = None # Le sprite choisi # Charger les 10 sprites for i in range(10): - sprite_image = pygame.transform.scale(pygame.image.load(f"V5.6/{i+1}.png"), (SPRITE_WIDTH, SPRITE_HEIGHT)) + sprite_image = pygame.transform.scale(pygame.image.load(f"assets/{i+1}.png"), (SPRITE_WIDTH, SPRITE_HEIGHT)) sprites.append(sprite_image) sprite_rect = sprite_image.get_rect() sprite_rect.topleft = (listex[i], listey[i]) # Définir les coordonnées du sprite @@ -69,7 +70,7 @@ for i in range(10): # Charger une musique parmis la super compilation i = random.randint(0, 16) -path = 'V5.6/output_folder/mp3/' +path = 'assets/mp3/' musique = path + str(i) + '.mp3' pygame.mixer.music.load(musique) @@ -85,7 +86,7 @@ y_rectangle = 0 # En haut de l'écran def openuseragents(file: str): with open(file, newline='') as csvfile: return [row for row in csv.DictReader(csvfile, delimiter=';')][0] -stats = openuseragents('V5.6/.logs.csv') +stats = openuseragents('assets/.logs.csv') # Variables du jeu score = 0 @@ -95,7 +96,7 @@ nbrotation = 0 rotate = 0 # Initialisation de l'écran de jeu screen = pygame.display.set_mode((WIDTH, HEIGHT)) -pygame.display.set_caption("Jeu V7") +pygame.display.set_caption("Projet-foot V7") def start_screen(): @@ -148,10 +149,10 @@ def game(i): global score, nbcoeur if i != None: - player_image = pygame.transform.scale(pygame.image.load(f"V5.6/{i+1}.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) + player_image = pygame.transform.scale(pygame.image.load(f"assets/{i+1}.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) else: i = 0 - player_image = pygame.transform.scale(pygame.image.load(f"V5.6/{i+1}.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) + player_image = pygame.transform.scale(pygame.image.load(f"assets/{i+1}.png"), (PLAYER_WIDTH, PLAYER_HEIGHT)) # Position initiale de la balle ball_pos = [WIDTH // 2, BALL_RADIUS] @@ -271,7 +272,13 @@ def game_over_screen(score): # screen.blit(perdu_text, perdu_text_rect) screen.blit(smiley_image, ((WIDTH // 2)-SMILEY_WIDTH/2, (HEIGHT // 2)-SPRITE_HEIGHT/2)) # Le smiley - moy = floor(100*( (int(stats['moy'])*int(stats['nbparties'])) + (score) )/(int(stats['nbparties'])+1))/100 + + moy = float(stats['moy']) + nbparties = float() + + dec = (( moy * nbparties ) + score) / (nbparties + 1) + moy = floor(100 * dec ) / 100 + texte = "Perdu\n Votre score était de : " + str(score) + "\n Le score moyen est de : " + str(moy) + '\n Votre meilleur score était de : ' + str(stats['best']) lignes = texte.split("\n") # Diviser le texte en lignes y = 50 # Position y initiale du texte @@ -291,11 +298,15 @@ def game_over_screen(score): l1 = 'score;moy;best;nbparties' l2 = str(str(score) + ';' + str(moy) + ';' + str(best) + ';' + str((int(stats['nbparties'])+1))) - with open('.logs.csv', "a") as f: - f.write(l1 + '\n' + l2) + try: + os.remove('assets/.logs.csv') + with open('assets/.logs.csv', "a") as f: + f.write(l1 + '\n' + l2 + '\n') + except Exception as e: + print(e) pygame.display.flip() - pygame.time.wait(5000) + pygame.time.wait(3000) def replay_screen(): @@ -364,7 +375,7 @@ while running: game_over = game(selected_skin) print(game_over) if game_over[0] == False: - game_over_screen(score) + game_over_screen(game_over[1]) change = replay_screen() print(change) if change == False: diff --git a/releases/V1.zip b/releases/V1.zip new file mode 100644 index 0000000..fb44237 Binary files /dev/null and b/releases/V1.zip differ diff --git a/releases/V2.zip b/releases/V2.zip new file mode 100644 index 0000000..6411717 Binary files /dev/null and b/releases/V2.zip differ diff --git a/releases/V3.zip b/releases/V3.zip new file mode 100644 index 0000000..e64207f Binary files /dev/null and b/releases/V3.zip differ diff --git a/releases/V4.zip b/releases/V4.zip new file mode 100644 index 0000000..9ce3504 Binary files /dev/null and b/releases/V4.zip differ diff --git a/releases/V5.5.zip b/releases/V5.5.zip new file mode 100644 index 0000000..9b4745f Binary files /dev/null and b/releases/V5.5.zip differ diff --git a/code.zip b/releases/V5.6.zip similarity index 99% rename from code.zip rename to releases/V5.6.zip index cc43f9e..3262913 100644 Binary files a/code.zip and b/releases/V5.6.zip differ diff --git a/releases/V5.zip b/releases/V5.zip new file mode 100644 index 0000000..7115313 Binary files /dev/null and b/releases/V5.zip differ diff --git a/releases/V6.zip b/releases/V6.zip new file mode 100644 index 0000000..93a8a1a Binary files /dev/null and b/releases/V6.zip differ diff --git a/releases/V7.zip b/releases/V7.zip new file mode 100644 index 0000000..623d1a9 Binary files /dev/null and b/releases/V7.zip differ diff --git a/V5.6/besoindemusiques.py b/temp/besoindemusiques.py similarity index 100% rename from V5.6/besoindemusiques.py rename to temp/besoindemusiques.py diff --git a/V5.6/output_folder/all/0.webm b/temp/output_folder/all/0.webm similarity index 100% rename from V5.6/output_folder/all/0.webm rename to temp/output_folder/all/0.webm diff --git a/V5.6/output_folder/all/1.webm b/temp/output_folder/all/1.webm similarity index 100% rename from V5.6/output_folder/all/1.webm rename to temp/output_folder/all/1.webm diff --git a/V5.6/output_folder/all/10.webm b/temp/output_folder/all/10.webm similarity index 100% rename from V5.6/output_folder/all/10.webm rename to temp/output_folder/all/10.webm diff --git a/V5.6/output_folder/all/11.webm b/temp/output_folder/all/11.webm similarity index 100% rename from V5.6/output_folder/all/11.webm rename to temp/output_folder/all/11.webm diff --git a/V5.6/output_folder/all/12.webm b/temp/output_folder/all/12.webm similarity index 100% rename from V5.6/output_folder/all/12.webm rename to temp/output_folder/all/12.webm diff --git a/V5.6/output_folder/all/13.webm b/temp/output_folder/all/13.webm similarity index 100% rename from V5.6/output_folder/all/13.webm rename to temp/output_folder/all/13.webm diff --git a/V5.6/output_folder/all/14.opus b/temp/output_folder/all/14.opus similarity index 100% rename from V5.6/output_folder/all/14.opus rename to temp/output_folder/all/14.opus diff --git a/V5.6/output_folder/all/15.m4a b/temp/output_folder/all/15.m4a similarity index 100% rename from V5.6/output_folder/all/15.m4a rename to temp/output_folder/all/15.m4a diff --git a/V5.6/output_folder/all/16.opus b/temp/output_folder/all/16.opus similarity index 100% rename from V5.6/output_folder/all/16.opus rename to temp/output_folder/all/16.opus diff --git a/V5.6/output_folder/all/2.webm b/temp/output_folder/all/2.webm similarity index 100% rename from V5.6/output_folder/all/2.webm rename to temp/output_folder/all/2.webm diff --git a/V5.6/output_folder/all/3.webm b/temp/output_folder/all/3.webm similarity index 100% rename from V5.6/output_folder/all/3.webm rename to temp/output_folder/all/3.webm diff --git a/V5.6/output_folder/all/4.webm b/temp/output_folder/all/4.webm similarity index 100% rename from V5.6/output_folder/all/4.webm rename to temp/output_folder/all/4.webm diff --git a/V5.6/output_folder/all/5.webm b/temp/output_folder/all/5.webm similarity index 100% rename from V5.6/output_folder/all/5.webm rename to temp/output_folder/all/5.webm diff --git a/V5.6/output_folder/all/6.webm b/temp/output_folder/all/6.webm similarity index 100% rename from V5.6/output_folder/all/6.webm rename to temp/output_folder/all/6.webm diff --git a/V5.6/output_folder/all/7.webm b/temp/output_folder/all/7.webm similarity index 100% rename from V5.6/output_folder/all/7.webm rename to temp/output_folder/all/7.webm diff --git a/V5.6/output_folder/all/8.webm b/temp/output_folder/all/8.webm similarity index 100% rename from V5.6/output_folder/all/8.webm rename to temp/output_folder/all/8.webm diff --git a/V5.6/output_folder/all/9.webm b/temp/output_folder/all/9.webm similarity index 100% rename from V5.6/output_folder/all/9.webm rename to temp/output_folder/all/9.webm diff --git a/V5.6/output_folder/fusion.bat b/temp/output_folder/fusion.bat similarity index 100% rename from V5.6/output_folder/fusion.bat rename to temp/output_folder/fusion.bat diff --git a/V5.6/playlist for silly goofsters.webm b/temp/playlist for silly goofsters.webm similarity index 100% rename from V5.6/playlist for silly goofsters.webm rename to temp/playlist for silly goofsters.webm