diff --git a/.gitignore b/.gitignore index 39666b5..44d290d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ checkpoint.db-journal game.db map/infinite/* -temp_audio.mp3 \ No newline at end of file +temp_audio.mp3 +output.prof \ No newline at end of file diff --git a/profiler.py b/profiler.py new file mode 100644 index 0000000..1d04425 --- /dev/null +++ b/profiler.py @@ -0,0 +1,9 @@ +import cProfile +from src.handler import handler + + +def main(): + handler() + + +cProfile.run("main()", "output.prof") diff --git a/src/Database/CheckpointDB.py b/src/Database/CheckpointDB.py index 0c8a317..dce97bc 100644 --- a/src/Database/CheckpointDB.py +++ b/src/Database/CheckpointDB.py @@ -81,3 +81,18 @@ class CheckpointDB: self.conn.commit() except Exception as e: print(f"Error clearing checkpoint database: {e}") + + def reset_level(self, map_name): + """ + Reset the checkpoint for a specific map + + Args: + map_name: Map name to reset + """ + try: + self.cursor.execute( + "DELETE FROM checkpoints WHERE map_name = ?", (map_name,) + ) + self.conn.commit() + except Exception as e: + print(f"Error resetting checkpoint for {map_name}: {e}") diff --git a/src/constant.py b/src/constant.py index 06a2c70..38c5ed9 100644 --- a/src/constant.py +++ b/src/constant.py @@ -16,6 +16,12 @@ class GameResources: self.life_icon_width = 50 self.fullscreen = False + try: + icon = pygame.image.load("assets/player/Sanic Head.png") + pygame.display.set_icon(icon) + except Exception as e: + print(f"Erreur lors du chargement de l'icĂ´ne: {e}") + # Ressources self.platforms = pygame.sprite.Group() self.all_sprites = pygame.sprite.Group() diff --git a/src/game.py b/src/game.py index 4f4989b..183afad 100644 --- a/src/game.py +++ b/src/game.py @@ -27,6 +27,9 @@ def initialize_game(game_resources, map_file="map/levels/1.json"): Returns: tuple: (player, platform, platforms_group, all_sprites, background, checkpoints, exits) """ + checkpointDB = CheckpointDB() + checkpointDB.reset_level(map_file) + checkpointDB.close() parser = MapParser(game_resources) map_objects = parser.load_map(map_file)