From 51143d9507af16693d85765ff4f5296610080b91 Mon Sep 17 00:00:00 2001 From: DylanVsn <43576618+DylanVsn@users.noreply.github.com> Date: Wed, 20 Nov 2019 16:57:14 +0100 Subject: [PATCH] =?UTF-8?q?les=20pacdots=20=C3=A0=20afficher=20dans=20pacm?= =?UTF-8?q?ap.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphic.py | 2 +- src/pacmap.py | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/graphic.py b/src/graphic.py index d88acc9..154546e 100755 --- a/src/graphic.py +++ b/src/graphic.py @@ -17,7 +17,7 @@ class Screen: self.pacman = pacman self.pacman_sprite = pacman_sprite.PacmanSprite(size[0]/28) self.clock = pg.time.Clock() - self.max_fps = 40 + self.max_fps = 60 self.entity_group = pg.sprite.Group(self.pacman_sprite) self.loop() diff --git a/src/pacmap.py b/src/pacmap.py index 2ca17ef..c7bfbf1 100755 --- a/src/pacmap.py +++ b/src/pacmap.py @@ -65,7 +65,8 @@ class Map: else: self.phys_map = phys_map # in the first part we assume phys_map is correct and no need to verify self.dots_map = dots_map - self.intersect_map = [] # TODO - the layer which contains intersections pre-calculated + # self.intersect_map = [] # TODO - the layer which contains intersections pre-calculated + self.create_cross_layer() def verify(self, phys_map, dots_map) -> bool: @@ -164,6 +165,7 @@ class Map: return self.phys_map[y][x] def create_cross_layer(self): + self.intersect_map = [] dictionnary = { (0, 1):CrossTile.DOWN, (0, -1): CrossTile.UP, @@ -186,8 +188,17 @@ class Map: def draw(self, surf): surf.blit(self._surf, (0, 0)) - self._dot_surf.fill() - + # self._dot_surf.fill(surf) + + def _draw_dots(self, surf): + for row in len(self.dots_map): + for col in len(self.dots_map[0]): + if self.phys_map[row][col] == PhysTile.GRD and self.dots_map[row][col] == DotTile.SPD: + # petits rond + pass + elif self.phys_map[row][col] == PhysTile.GRD and self.dots_map[row][col] == DotTile.BPD: + # big pac dot + pass def decode_map(self, img_file): img = Image.open(img_file)