From 7c83057ae049a6001732529791850a0ad0430376 Mon Sep 17 00:00:00 2001 From: marblexu <314299052@qq.com> Date: Sun, 15 Dec 2019 08:41:40 +0800 Subject: [PATCH] fix planting chomper at the wrong grid --- source/component/plant.py | 2 +- source/state/level.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/component/plant.py b/source/component/plant.py index 2fd8878..ce4c4e6 100644 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -115,7 +115,7 @@ class Plant(pg.sprite.Sprite): self.frame_num = len(self.frames) self.image = self.frames[self.frame_index] self.rect = self.image.get_rect() - self.rect.x = x + self.rect.centerx = x self.rect.bottom = y self.name = name diff --git a/source/state/level.py b/source/state/level.py index 25ba8db..7106fd4 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -202,7 +202,7 @@ class Level(tool.State): if self.hint_image is None: self.setupHintImage() - x, y = self.hint_rect.x, self.hint_rect.bottom + x, y = self.hint_rect.centerx, self.hint_rect.bottom map_x, map_y = self.map.getMapIndex(x, y) if self.plant_name == c.SUNFLOWER: new_plant = plant.SunFlower(x, y, self.sun_group)