Changed level

This commit is contained in:
theo@manjaro 2021-11-16 10:37:39 +01:00
parent b48dc63872
commit 3dded48eee
3 changed files with 196 additions and 204 deletions

View File

@ -96,7 +96,7 @@ class Game():
self.pasttime = time.time()
# Je charge la scene de base
scenes.main(self)
scenes.fight(self)
def set_camera(self,posx,posy):
self.globals["camerax"], self.globals["cameray"] = posx,posy

View File

@ -229,10 +229,10 @@
[-1],
[-1],
[-1],
[0, 4],
[1, 4],
[1, 4],
[2, 4],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
@ -332,7 +332,6 @@
[-1],
[-1],
[-1],
[9, 7],
[-1],
[-1],
[-1],
@ -342,18 +341,6 @@
[-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],
@ -361,20 +348,72 @@
[-1],
[-1],
[-1],
[8, 7],
[-1],
[-1],
[9, 7],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1]
],
[
[0, 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],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1]
],
[
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
@ -404,22 +443,9 @@
[1, 0],
[1, 0],
[1, 0],
[2, 0]
[1, 0]
],
[
[0, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[2, 1],
[-1],
[-1],
[-1],
[-1],
[10, 6],
[11, 6],
[-1],
[-1],
[-1],
@ -434,8 +460,21 @@
[-1],
[-1],
[-1],
[10, 6],
[11, 6],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[0, 1],
[1, 1],
@ -443,55 +482,16 @@
[1, 1],
[1, 1],
[1, 1],
[2, 1]
[1, 1]
],
[
[0, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[2, 1],
[-1],
[-1],
[8, 7],
[-1],
[10, 7],
[11, 7],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[10, 7],
[11, 7],
[-1],
[0, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[2, 1]
],
[
[0, 2],
[1, 2],
[5, 0],
[1, 1],
[1, 1],
[1, 1],
[3, 2],
[0, 0],
[1, 0],
[1, 0],
[1, 0],
[1, 0],
[1, 0],
[1, 0],
[1, 0],
[1, 0],
@ -508,28 +508,28 @@
[-1],
[-1],
[-1],
[-1],
[0, 0],
[1, 0],
[1, 0],
[1, 0],
[1, 0],
[0, 4],
[1, 4],
[1, 4],
[1, 4],
[6, 0],
[8, 0],
[1, 0],
[5, 2],
[1, 1],
[1, 1],
[1, 1],
[3, 0],
[1, 2],
[2, 2]
[1, 1],
[1, 1],
[1, 1]
],
[
[-1],
[-1],
[0, 2],
[1, 2],
[1, 2],
[5, 0],
[0, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
@ -547,6 +547,22 @@
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[6, 1],
[9, 2],
[8, 0],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1]
],
[
[-1],
[0, 1],
[1, 1],
@ -555,24 +571,8 @@
[1, 1],
[1, 1],
[1, 1],
[3, 0],
[1, 2],
[1, 2],
[2, 2],
[-1],
[-1]
],
[
[-1],
[-1],
[-1],
[-1],
[-1],
[0, 2],
[1, 2],
[1, 2],
[1, 2],
[5, 0],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
@ -586,61 +586,75 @@
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[6, 1],
[7, 1],
[9, 2],
[8, 0],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1]
],
[
[-1],
[0, 1],
[1, 1],
[1, 1],
[3, 0],
[1, 2],
[1, 2],
[1, 2],
[2, 2],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[2, 1],
[-1],
[-1],
[-1],
[-1],
[-1]
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[6, 1],
[7, 1],
[7, 1],
[8, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1]
],
[
[-1],
[-1],
[-1],
[-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],
[0, 2],
[1, 2],
[1, 2],
[2, 2],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1]
],
[
[0, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[2, 1],
[-1],
[-1],
[-1],
@ -654,30 +668,16 @@
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1],
[-1]
[6, 1],
[7, 1],
[7, 1],
[8, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1],
[1, 1]
]
],
"exportMode": 1,
@ -693,16 +693,10 @@
"gridCellsX": 37,
"gridCellsY": 17,
"entities": [
{"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},
{"name": "Solid", "id": 18, "_eid": "17026310", "x": 512, "y": 192, "width": 48, "height": 32, "originX": 0, "originY": 0},
{"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": "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}
{"name": "Solid", "id": 25, "_eid": "17026310", "x": 16, "y": 192, "width": 208, "height": 64, "originX": 0, "originY": 0},
{"name": "Solid", "id": 26, "_eid": "17026310", "x": 432, "y": 192, "width": 160, "height": 48, "originX": 0, "originY": 0},
{"name": "Solid", "id": 27, "_eid": "17026310", "x": 480, "y": 160, "width": 112, "height": 32, "originX": 0, "originY": 0},
{"name": "SemiSolid", "id": 28, "_eid": "59763689", "x": 368, "y": 192, "width": 64, "height": 16, "originX": 0, "originY": 0}
]
},
{
@ -715,10 +709,7 @@
"gridCellsX": 37,
"gridCellsY": 17,
"entities": [
{"name": "Spawns", "id": 0, "_eid": "25816588", "x": 416, "y": 160, "originX": 0, "originY": 0},
{"name": "Spawns", "id": 1, "_eid": "25816588", "x": 528, "y": 112, "originX": 0, "originY": 0},
{"name": "Spawns", "id": 2, "_eid": "25816588", "x": 160, "y": 160, "originX": 0, "originY": 0},
{"name": "Spawns", "id": 3, "_eid": "25816588", "x": 48, "y": 112, "originX": 0, "originY": 0}
{"name": "Spawns", "id": 4, "_eid": "25816588", "x": 64, "y": 144, "originX": 0, "originY": 0}
]
}
]

View File

@ -28,6 +28,7 @@ class TilesetRenderer(BaseObject):
self.semirects = []
self.layers = []
self.spawns = [[self.game.DISPLAY_WIDTH//2,self.game.DISPLAY_HEIGHT//2]] # Valeur par défaut
spawnlists = {"Spawns":self.spawn}
if "layers" in json.keys() and type(json["layers"]).__name__=="list":
solidlayer = False
for layer in json["layers"]:
@ -45,7 +46,7 @@ class TilesetRenderer(BaseObject):
w = entity["width"]
if "height" in entity.keys():
h = entity["height"]
self.spawns.append(self.game.pygame.Rect((x,y,w,h)))
spawnlists[entity["name"]].append(self.game.pygame.Rect((x,y,w,h)))
else: # J'ajoute un layer de tiles
tileset = level["tilesets"][layer["tileset"]]