diff --git a/gamedata/maps/TulipFields/base.png b/gamedata/maps/TulipFields/base.png index d1cc1b8..e501926 100644 Binary files a/gamedata/maps/TulipFields/base.png and b/gamedata/maps/TulipFields/base.png differ diff --git a/gamedata/maps/TulipFields/map.json b/gamedata/maps/TulipFields/map.json index 69537d4..aed4443 100644 --- a/gamedata/maps/TulipFields/map.json +++ b/gamedata/maps/TulipFields/map.json @@ -74,8 +74,8 @@ [-1], [-1], [-1], - [12, 6], - [13, 6], + [-1], + [-1], [-1], [-1], [-1], @@ -113,8 +113,8 @@ [-1], [-1], [-1], - [12, 7], - [13, 7], + [-1], + [-1], [-1], [-1], [-1], @@ -147,18 +147,18 @@ [-1], [-1], [-1], - [0, 0], - [1, 0], - [1, 0], - [1, 0], - [1, 0], - [1, 0], - [1, 0], - [1, 0], - [1, 0], - [1, 0], - [1, 0], - [2, 0], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], [-1], [-1], [-1], @@ -186,18 +186,18 @@ [-1], [-1], [-1], - [5, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [3, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], [-1], [-1], [-1], @@ -223,22 +223,22 @@ [-1], [-1], [-1], - [0, 0], - [1, 0], - [5, 2], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [1, 1], - [3, 2], - [1, 0], - [2, 0], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [0, 4], + [1, 4], + [1, 4], + [2, 4], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], [-1], [-1], [-1], @@ -262,22 +262,22 @@ [-1], [-1], [-1], - [0, 1], - [1, 1], - [1, 1], - [1, 1], - [3, 0], - [1, 2], - [1, 2], - [1, 2], - [1, 2], - [1, 2], - [1, 2], - [5, 0], - [1, 1], - [1, 1], - [1, 1], - [2, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], [-1], [-1], [-1], @@ -301,22 +301,22 @@ [-1], [-1], [-1], - [0, 2], - [1, 2], - [1, 2], - [1, 2], - [2, 2], [-1], [-1], [-1], [-1], [-1], [-1], - [0, 2], - [1, 2], - [1, 2], - [1, 2], - [2, 2], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], [-1], [-1], [-1], @@ -342,18 +342,18 @@ [-1], [-1], [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], + [0, 4], + [1, 4], + [1, 4], + [1, 4], + [1, 4], + [1, 4], + [1, 4], + [1, 4], + [1, 4], + [1, 4], + [1, 4], + [2, 4], [-1], [-1], [-1], @@ -693,9 +693,6 @@ "gridCellsX": 37, "gridCellsY": 17, "entities": [ - {"name": "Solid", "id": 12, "_eid": "17026310", "x": 208, "y": 48, "width": 192, "height": 64, "originX": 0, "originY": 0}, - {"name": "Solid", "id": 13, "_eid": "17026310", "x": 176, "y": 80, "width": 80, "height": 48, "originX": 0, "originY": 0}, - {"name": "Solid", "id": 14, "_eid": "17026310", "x": 352, "y": 80, "width": 80, "height": 48, "originX": 0, "originY": 0}, {"name": "Solid", "id": 15, "_eid": "17026310", "x": 480, "y": 144, "width": 112, "height": 64, "originX": 0, "originY": 0}, {"name": "Solid", "id": 16, "_eid": "17026310", "x": 384, "y": 192, "width": 64, "height": 64, "originX": 0, "originY": 0}, {"name": "Solid", "id": 17, "_eid": "17026310", "x": 448, "y": 192, "width": 64, "height": 48, "originX": 0, "originY": 0}, @@ -703,7 +700,9 @@ {"name": "Solid", "id": 19, "_eid": "17026310", "x": 0, "y": 144, "width": 112, "height": 64, "originX": 0, "originY": 0}, {"name": "Solid", "id": 20, "_eid": "17026310", "x": 144, "y": 192, "width": 80, "height": 64, "originX": 0, "originY": 0}, {"name": "Solid", "id": 21, "_eid": "17026310", "x": 80, "y": 192, "width": 64, "height": 48, "originX": 0, "originY": 0}, - {"name": "Solid", "id": 22, "_eid": "17026310", "x": 32, "y": 208, "width": 48, "height": 16, "originX": 0, "originY": 0} + {"name": "Solid", "id": 22, "_eid": "17026310", "x": 32, "y": 208, "width": 48, "height": 16, "originX": 0, "originY": 0}, + {"name": "SemiSolid", "id": 23, "_eid": "59763689", "x": 208, "y": 128, "width": 192, "height": 16, "originX": 0, "originY": 0}, + {"name": "SemiSolid", "id": 24, "_eid": "59763689", "x": 272, "y": 80, "width": 64, "height": 16, "originX": 0, "originY": 0} ] }, { diff --git a/gamedata/objects/combat/player.py b/gamedata/objects/combat/player.py index 36abf5e..a540cc2 100644 --- a/gamedata/objects/combat/player.py +++ b/gamedata/objects/combat/player.py @@ -14,6 +14,7 @@ class Player(BaseObject): super().__init__(x,y,game,self.sprite.get_width(),self.sprite.get_height()) self.collisionrects = tileset.rects + self.semirects = tileset.semirects self.tilew = tileset.solidtilew self.tileh = tileset.solidtileh @@ -37,7 +38,7 @@ class Player(BaseObject): self.onground = False if self.checkcollisions(0,1): self.onground = True - self.vertical=0 + self.vertical=min(0,self.vertical) else: self.vertical+=self.gravity*self.game.dt self.vertical = min(self.maxgravity,self.vertical) @@ -114,6 +115,12 @@ class Player(BaseObject): if temprect.colliderect(rect): result = rect break + if not result: + for rect in self.semirects: + if self.rect.bottom<=rect.top: + if temprect.colliderect(rect): + result = rect + break return result def draw(self): diff --git a/gamedata/objects/combat/tileset.py b/gamedata/objects/combat/tileset.py index 94664b7..4fc9b10 100644 --- a/gamedata/objects/combat/tileset.py +++ b/gamedata/objects/combat/tileset.py @@ -25,6 +25,7 @@ class TilesetRenderer(BaseObject): json = level["data"] name = level["name"] self.rects = [] + self.semirects = [] self.layers = [] self.spawns = [[self.game.DISPLAY_WIDTH//2,self.game.DISPLAY_HEIGHT//2]] # Valeur par défaut if "layers" in json.keys() and type(json["layers"]).__name__=="list": @@ -79,9 +80,10 @@ class TilesetRenderer(BaseObject): w = entity["width"] if "height" in entity.keys(): h = entity["height"] - self.rects.append(self.game.pygame.Rect(x,y,w,h)) + lists = {"Solid":self.rects,"SemiSolid":self.semirects} + lists[entity["name"]].append(self.game.pygame.Rect(x,y,w,h)) except: - self.game.log("Erreur",name,"Propriétés invalides") + self.game.log("Erreur",name,entity,"Propriétés invalides") else: self.game.log("Erreur",name,"Il manque les collisions, Entity Layer nommé Solids")