From 3036ccd1e875e8d93d0000bd0689a7c49cff1033 Mon Sep 17 00:00:00 2001 From: Louis Pearson Date: Tue, 9 Aug 2022 16:34:05 -0600 Subject: [PATCH] Allow spawn outside of first room --- assets/maps/wired.ldtk | 486 +++++++++++++++++++++++++++++++++++++++-- src/game.zig | 11 +- 2 files changed, 469 insertions(+), 28 deletions(-) diff --git a/assets/maps/wired.ldtk b/assets/maps/wired.ldtk index 32dc4ad..7e68601 100644 --- a/assets/maps/wired.ldtk +++ b/assets/maps/wired.ldtk @@ -10,7 +10,7 @@ }, "jsonVersion": "1.1.3", "appBuildId": 458364, - "nextUid": 133, + "nextUid": 134, "identifierStyle": "Capitalize", "worldLayout": "GridVania", "worldGridWidth": 160, @@ -2581,20 +2581,6 @@ "overrideTilesetUid": null, "gridTiles": [], "entityInstances": [ - { - "__identifier": "Player", - "__grid": [1,18], - "__pivot": [0,0], - "__tags": [], - "__tile": null, - "__smartColor": "#94D9B3", - "iid": "a24ab080-02f0-11ed-9529-212a82eba0d7", - "width": 8, - "height": 8, - "defUid": 31, - "px": [8,144], - "fieldInstances": [] - }, { "__identifier": "Door", "__grid": [0,18], @@ -3935,7 +3921,7 @@ "entityInstances": [] } ], - "__neighbours": [{ "levelIid": "7dc5aee0-02f0-11ed-9529-3918554111b1", "levelUid": 62, "dir": "w" }] + "__neighbours": [ { "levelIid": "7dc5aee0-02f0-11ed-9529-3918554111b1", "levelUid": 62, "dir": "w" }, { "levelIid": "5e485d80-02f0-11ed-9529-fdd91571342b", "levelUid": 133, "dir": "n" } ] }, { "identifier": "Level_3", @@ -4049,8 +4035,8 @@ 0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1, + 0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1, 1,1,1,1,3,3,0,1,1,1,1,1,1,1,1 ], "autoLayerTiles": [ @@ -4067,6 +4053,7 @@ { "px": [128,152], "src": [112,56], "f": 0, "t": 126, "d": [5,396] }, { "px": [136,152], "src": [112,56], "f": 0, "t": 126, "d": [5,397] }, { "px": [144,152], "src": [112,56], "f": 0, "t": 126, "d": [5,398] }, + { "px": [152,152], "src": [112,56], "f": 0, "t": 126, "d": [5,399] }, { "px": [0,8], "src": [88,56], "f": 0, "t": 123, "d": [6,20] }, { "px": [0,16], "src": [88,56], "f": 0, "t": 123, "d": [6,40] }, { "px": [0,24], "src": [88,56], "f": 0, "t": 123, "d": [6,60] }, @@ -4117,11 +4104,8 @@ { "px": [152,96], "src": [104,56], "f": 0, "t": 125, "d": [8,259] }, { "px": [152,104], "src": [104,56], "f": 0, "t": 125, "d": [8,279] }, { "px": [152,112], "src": [104,56], "f": 0, "t": 125, "d": [8,299] }, - { "px": [152,120], "src": [104,56], "f": 0, "t": 125, "d": [8,319] }, - { "px": [152,128], "src": [104,56], "f": 0, "t": 125, "d": [8,339] }, - { "px": [152,136], "src": [104,56], "f": 0, "t": 125, "d": [8,359] }, - { "px": [152,144], "src": [104,56], "f": 0, "t": 125, "d": [8,379] }, { "px": [64,152], "src": [80,56], "f": 0, "t": 122, "d": [9,388] }, + { "px": [152,120], "src": [40,56], "f": 0, "t": 117, "d": [11,319] }, { "px": [96,152], "src": [96,56], "f": 0, "t": 124, "d": [12,392] }, { "px": [80,152], "src": [24,16], "f": 0, "t": 35, "d": [126,390] }, { "px": [72,152], "src": [16,16], "f": 0, "t": 34, "d": [127,389] } @@ -4132,7 +4116,463 @@ "entityInstances": [] } ], - "__neighbours": [{ "levelIid": "7dc5aee0-02f0-11ed-9529-3918554111b1", "levelUid": 62, "dir": "s" }] + "__neighbours": [ { "levelIid": "7dc5aee0-02f0-11ed-9529-3918554111b1", "levelUid": 62, "dir": "s" }, { "levelIid": "5e485d80-02f0-11ed-9529-fdd91571342b", "levelUid": 133, "dir": "e" } ] + }, + { + "identifier": "Level_4", + "iid": "5e485d80-02f0-11ed-9529-fdd91571342b", + "uid": 133, + "worldX": 320, + "worldY": -160, + "worldDepth": 0, + "pxWid": 160, + "pxHei": 160, + "__bgColor": "#696A79", + "bgColor": null, + "useAutoIdentifier": true, + "bgRelPath": null, + "bgPos": null, + "bgPivotX": 0.5, + "bgPivotY": 0.5, + "__smartColor": "#ADADB5", + "__bgPos": null, + "externalRelPath": null, + "fieldInstances": [], + "layerInstances": [ + { + "__identifier": "Entities", + "__type": "Entities", + "__cWid": 20, + "__cHei": 20, + "__gridSize": 8, + "__opacity": 1, + "__pxTotalOffsetX": 0, + "__pxTotalOffsetY": 0, + "__tilesetDefUid": null, + "__tilesetRelPath": null, + "iid": "5e488490-02f0-11ed-9529-97ae962f42ba", + "levelId": 133, + "layerDefUid": 32, + "pxOffsetX": 0, + "pxOffsetY": 0, + "visible": true, + "optionalRules": [], + "intGridCsv": [], + "autoLayerTiles": [], + "seed": 5186138, + "overrideTilesetUid": null, + "gridTiles": [], + "entityInstances": [ + { + "__identifier": "Player", + "__grid": [1,18], + "__pivot": [0,0], + "__tags": [], + "__tile": null, + "__smartColor": "#94D9B3", + "iid": "a24ab080-02f0-11ed-9529-212a82eba0d7", + "width": 8, + "height": 8, + "defUid": 31, + "px": [8,144], + "fieldInstances": [] + }, + { + "__identifier": "Trapdoor", + "__grid": [9,3], + "__pivot": [0,0], + "__tags": ["Door"], + "__tile": { "tilesetUid": 1, "x": 24, "y": 0, "w": 8, "h": 8 }, + "__smartColor": "#4B2B8D", + "iid": "6f8a7a40-02f0-11ed-9529-d178c0b9c387", + "width": 8, + "height": 8, + "defUid": 63, + "px": [72,24], + "fieldInstances": [] + }, + { + "__identifier": "Trapdoor", + "__grid": [10,3], + "__pivot": [0,0], + "__tags": ["Door"], + "__tile": { "tilesetUid": 1, "x": 24, "y": 0, "w": 8, "h": 8 }, + "__smartColor": "#4B2B8D", + "iid": "6fca1b50-02f0-11ed-9529-816d5fad9e48", + "width": 8, + "height": 8, + "defUid": 63, + "px": [80,24], + "fieldInstances": [] + }, + { + "__identifier": "Trapdoor", + "__grid": [9,9], + "__pivot": [0,0], + "__tags": ["Door"], + "__tile": { "tilesetUid": 1, "x": 24, "y": 0, "w": 8, "h": 8 }, + "__smartColor": "#4B2B8D", + "iid": "d882bb20-02f0-11ed-9529-a7375a2fc3b7", + "width": 8, + "height": 8, + "defUid": 63, + "px": [72,72], + "fieldInstances": [] + }, + { + "__identifier": "Trapdoor", + "__grid": [10,9], + "__pivot": [0,0], + "__tags": ["Door"], + "__tile": { "tilesetUid": 1, "x": 24, "y": 0, "w": 8, "h": 8 }, + "__smartColor": "#4B2B8D", + "iid": "d8e5e9c0-02f0-11ed-9529-679772105563", + "width": 8, + "height": 8, + "defUid": 63, + "px": [80,72], + "fieldInstances": [] + }, + { + "__identifier": "Wire", + "__grid": [10,15], + "__pivot": [0.5,0.5], + "__tags": [], + "__tile": null, + "__smartColor": "#BC2634", + "iid": "38046dd0-02f0-11ed-9529-1df05b0ac8d5", + "width": 8, + "height": 8, + "defUid": 93, + "px": [84,124], + "fieldInstances": [ + { "__identifier": "Point", "__value": [{ "cx": 15, "cy": 15 }], "__type": "Array", "__tile": null, "defUid": 94, "realEditorValues": [{ + "id": "V_String", + "params": ["15,15"] + }] }, + { "__identifier": "Anchor", "__value": [ true, true ], "__type": "Array", "__tile": null, "defUid": 98, "realEditorValues": [ { + "id": "V_Bool", + "params": [ true ] + }, { + "id": "V_Bool", + "params": [ true ] + } ] } + ] + }, + { + "__identifier": "Door", + "__grid": [3,18], + "__pivot": [0,0], + "__tags": ["Door"], + "__tile": { "tilesetUid": 1, "x": 16, "y": 0, "w": 8, "h": 8 }, + "__smartColor": "#4B2B8D", + "iid": "78ab1c10-02f0-11ed-9529-cbfa20cb5d8f", + "width": 8, + "height": 8, + "defUid": 60, + "px": [24,144], + "fieldInstances": [] + }, + { + "__identifier": "Door", + "__grid": [8,18], + "__pivot": [0,0], + "__tags": ["Door"], + "__tile": { "tilesetUid": 1, "x": 16, "y": 0, "w": 8, "h": 8 }, + "__smartColor": "#4B2B8D", + "iid": "795fc610-02f0-11ed-9529-b5ee255ca4b7", + "width": 8, + "height": 8, + "defUid": 60, + "px": [64,144], + "fieldInstances": [] + }, + { + "__identifier": "Door", + "__grid": [16,18], + "__pivot": [0,0], + "__tags": ["Door"], + "__tile": { "tilesetUid": 1, "x": 16, "y": 0, "w": 8, "h": 8 }, + "__smartColor": "#4B2B8D", + "iid": "7a0247a0-02f0-11ed-9529-b170ce028c9f", + "width": 8, + "height": 8, + "defUid": 60, + "px": [128,144], + "fieldInstances": [] + } + ] + }, + { + "__identifier": "Circuit", + "__type": "IntGrid", + "__cWid": 20, + "__cHei": 20, + "__gridSize": 8, + "__opacity": 1, + "__pxTotalOffsetX": 0, + "__pxTotalOffsetY": 0, + "__tilesetDefUid": 1, + "__tilesetRelPath": "../tiles.png", + "iid": "5e488491-02f0-11ed-9529-b3642116e094", + "levelId": 133, + "layerDefUid": 28, + "pxOffsetX": 0, + "pxOffsetY": 0, + "visible": true, + "optionalRules": [], + "intGridCsv": [ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,0, + 0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1,1,1,1,0,0,0,1,0,0,0, + 0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,1,7,10,0,1,0,0, + 2,1,0,0,0,0,0,0,1,0,0,4,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0,1,1, + 1,1,1,0,0,0,1,0,0,0,0,0,0,8,0,0,9,0,8,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + ], + "autoLayerTiles": [ + { "px": [48,144], "src": [8,48], "f": 0, "t": 97, "d": [104,366] }, + { "px": [24,88], "src": [96,48], "f": 0, "t": 108, "d": [35,223] }, + { "px": [72,104], "src": [96,48], "f": 0, "t": 108, "d": [35,269] }, + { "px": [64,136], "src": [96,48], "f": 0, "t": 108, "d": [35,348] }, + { "px": [128,88], "src": [80,48], "f": 0, "t": 106, "d": [36,236] }, + { "px": [96,104], "src": [80,48], "f": 0, "t": 106, "d": [36,272] }, + { "px": [96,136], "src": [24,48], "f": 0, "t": 99, "d": [37,352] }, + { "px": [48,120], "src": [104,48], "f": 0, "t": 109, "d": [40,306] }, + { "px": [48,88], "src": [112,48], "f": 0, "t": 110, "d": [41,226] }, + { "px": [128,120], "src": [88,48], "f": 0, "t": 107, "d": [43,316] }, + { "px": [32,88], "src": [48,48], "f": 0, "t": 102, "d": [44,224] }, + { "px": [40,88], "src": [48,48], "f": 0, "t": 102, "d": [44,225] }, + { "px": [56,88], "src": [48,48], "f": 0, "t": 102, "d": [44,227] }, + { "px": [64,88], "src": [48,48], "f": 0, "t": 102, "d": [44,228] }, + { "px": [72,88], "src": [48,48], "f": 0, "t": 102, "d": [44,229] }, + { "px": [80,88], "src": [48,48], "f": 0, "t": 102, "d": [44,230] }, + { "px": [88,88], "src": [48,48], "f": 0, "t": 102, "d": [44,231] }, + { "px": [96,88], "src": [48,48], "f": 0, "t": 102, "d": [44,232] }, + { "px": [104,88], "src": [48,48], "f": 0, "t": 102, "d": [44,233] }, + { "px": [112,88], "src": [48,48], "f": 0, "t": 102, "d": [44,234] }, + { "px": [120,88], "src": [48,48], "f": 0, "t": 102, "d": [44,235] }, + { "px": [80,104], "src": [48,48], "f": 0, "t": 102, "d": [44,270] }, + { "px": [88,104], "src": [48,48], "f": 0, "t": 102, "d": [44,271] }, + { "px": [56,120], "src": [48,48], "f": 0, "t": 102, "d": [44,307] }, + { "px": [64,120], "src": [48,48], "f": 0, "t": 102, "d": [44,308] }, + { "px": [72,136], "src": [48,48], "f": 0, "t": 102, "d": [44,349] }, + { "px": [80,136], "src": [48,48], "f": 0, "t": 102, "d": [44,350] }, + { "px": [88,136], "src": [48,48], "f": 0, "t": 102, "d": [44,351] }, + { "px": [24,96], "src": [72,48], "f": 0, "t": 105, "d": [45,243] }, + { "px": [48,96], "src": [72,48], "f": 0, "t": 105, "d": [45,246] }, + { "px": [128,96], "src": [72,48], "f": 0, "t": 105, "d": [45,256] }, + { "px": [24,104], "src": [72,48], "f": 0, "t": 105, "d": [45,263] }, + { "px": [48,104], "src": [72,48], "f": 0, "t": 105, "d": [45,266] }, + { "px": [128,104], "src": [72,48], "f": 0, "t": 105, "d": [45,276] }, + { "px": [24,112], "src": [72,48], "f": 0, "t": 105, "d": [45,283] }, + { "px": [48,112], "src": [72,48], "f": 0, "t": 105, "d": [45,286] }, + { "px": [72,112], "src": [72,48], "f": 0, "t": 105, "d": [45,289] }, + { "px": [96,112], "src": [72,48], "f": 0, "t": 105, "d": [45,292] }, + { "px": [128,112], "src": [72,48], "f": 0, "t": 105, "d": [45,296] }, + { "px": [24,120], "src": [72,48], "f": 0, "t": 105, "d": [45,303] }, + { "px": [96,120], "src": [72,48], "f": 0, "t": 105, "d": [45,312] }, + { "px": [24,128], "src": [72,48], "f": 0, "t": 105, "d": [45,323] }, + { "px": [96,128], "src": [72,48], "f": 0, "t": 105, "d": [45,332] }, + { "px": [128,128], "src": [72,48], "f": 0, "t": 105, "d": [45,336] }, + { "px": [24,136], "src": [72,48], "f": 0, "t": 105, "d": [45,343] }, + { "px": [48,136], "src": [72,48], "f": 0, "t": 105, "d": [45,346] }, + { "px": [128,136], "src": [72,48], "f": 0, "t": 105, "d": [45,356] }, + { "px": [80,120], "src": [8,8], "f": 0, "t": 17, "d": [130,310] }, + { "px": [120,120], "src": [16,8], "f": 0, "t": 18, "d": [59,315] }, + { "px": [48,128], "src": [104,8], "f": 0, "t": 29, "d": [79,326] }, + { "px": [72,120], "src": [48,8], "f": 0, "t": 22, "d": [83,309] } + ], + "seed": 4888981, + "overrideTilesetUid": null, + "gridTiles": [], + "entityInstances": [] + }, + { + "__identifier": "Collision", + "__type": "IntGrid", + "__cWid": 20, + "__cHei": 20, + "__gridSize": 8, + "__opacity": 1, + "__pxTotalOffsetX": 0, + "__pxTotalOffsetY": 0, + "__tilesetDefUid": 1, + "__tilesetRelPath": "../tiles.png", + "iid": "5e488492-02f0-11ed-9529-fff977364cb9", + "levelId": 133, + "layerDefUid": 3, + "pxOffsetX": 0, + "pxOffsetY": 0, + "visible": true, + "optionalRules": [], + "intGridCsv": [ + 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,0,0,0,0,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,3,3,1,0,0,0,1,1,1,1,1,1,1,1,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1, + 1,1,1,1,1,1,1,1,1,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,0,0,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1, + 1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0, + 0,1,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,3,3,1,1,1,0, + 0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + ], + "autoLayerTiles": [ + { "px": [24,56], "src": [112,56], "f": 0, "t": 126, "d": [5,143] }, + { "px": [32,56], "src": [112,56], "f": 0, "t": 126, "d": [5,144] }, + { "px": [40,56], "src": [112,56], "f": 0, "t": 126, "d": [5,145] }, + { "px": [48,56], "src": [112,56], "f": 0, "t": 126, "d": [5,146] }, + { "px": [56,56], "src": [112,56], "f": 0, "t": 126, "d": [5,147] }, + { "px": [96,56], "src": [112,56], "f": 0, "t": 126, "d": [5,152] }, + { "px": [104,56], "src": [112,56], "f": 0, "t": 126, "d": [5,153] }, + { "px": [112,56], "src": [112,56], "f": 0, "t": 126, "d": [5,154] }, + { "px": [120,56], "src": [112,56], "f": 0, "t": 126, "d": [5,155] }, + { "px": [128,56], "src": [112,56], "f": 0, "t": 126, "d": [5,156] }, + { "px": [32,88], "src": [112,56], "f": 0, "t": 126, "d": [5,224] }, + { "px": [40,88], "src": [112,56], "f": 0, "t": 126, "d": [5,225] }, + { "px": [48,88], "src": [112,56], "f": 0, "t": 126, "d": [5,226] }, + { "px": [56,88], "src": [112,56], "f": 0, "t": 126, "d": [5,227] }, + { "px": [64,88], "src": [112,56], "f": 0, "t": 126, "d": [5,228] }, + { "px": [72,88], "src": [112,56], "f": 0, "t": 126, "d": [5,229] }, + { "px": [80,88], "src": [112,56], "f": 0, "t": 126, "d": [5,230] }, + { "px": [88,88], "src": [112,56], "f": 0, "t": 126, "d": [5,231] }, + { "px": [96,88], "src": [112,56], "f": 0, "t": 126, "d": [5,232] }, + { "px": [104,88], "src": [112,56], "f": 0, "t": 126, "d": [5,233] }, + { "px": [112,88], "src": [112,56], "f": 0, "t": 126, "d": [5,234] }, + { "px": [120,88], "src": [112,56], "f": 0, "t": 126, "d": [5,235] }, + { "px": [0,152], "src": [112,56], "f": 0, "t": 126, "d": [5,380] }, + { "px": [8,152], "src": [112,56], "f": 0, "t": 126, "d": [5,381] }, + { "px": [16,152], "src": [112,56], "f": 0, "t": 126, "d": [5,382] }, + { "px": [24,152], "src": [112,56], "f": 0, "t": 126, "d": [5,383] }, + { "px": [32,152], "src": [112,56], "f": 0, "t": 126, "d": [5,384] }, + { "px": [40,152], "src": [112,56], "f": 0, "t": 126, "d": [5,385] }, + { "px": [48,152], "src": [112,56], "f": 0, "t": 126, "d": [5,386] }, + { "px": [56,152], "src": [112,56], "f": 0, "t": 126, "d": [5,387] }, + { "px": [64,152], "src": [112,56], "f": 0, "t": 126, "d": [5,388] }, + { "px": [72,152], "src": [112,56], "f": 0, "t": 126, "d": [5,389] }, + { "px": [80,152], "src": [112,56], "f": 0, "t": 126, "d": [5,390] }, + { "px": [88,152], "src": [112,56], "f": 0, "t": 126, "d": [5,391] }, + { "px": [96,152], "src": [112,56], "f": 0, "t": 126, "d": [5,392] }, + { "px": [104,152], "src": [112,56], "f": 0, "t": 126, "d": [5,393] }, + { "px": [112,152], "src": [112,56], "f": 0, "t": 126, "d": [5,394] }, + { "px": [120,152], "src": [112,56], "f": 0, "t": 126, "d": [5,395] }, + { "px": [128,152], "src": [112,56], "f": 0, "t": 126, "d": [5,396] }, + { "px": [136,152], "src": [112,56], "f": 0, "t": 126, "d": [5,397] }, + { "px": [144,152], "src": [112,56], "f": 0, "t": 126, "d": [5,398] }, + { "px": [56,8], "src": [88,56], "f": 0, "t": 123, "d": [6,27] }, + { "px": [56,16], "src": [88,56], "f": 0, "t": 123, "d": [6,47] }, + { "px": [16,40], "src": [88,56], "f": 0, "t": 123, "d": [6,102] }, + { "px": [16,48], "src": [88,56], "f": 0, "t": 123, "d": [6,122] }, + { "px": [64,64], "src": [88,56], "f": 0, "t": 123, "d": [6,168] }, + { "px": [0,80], "src": [88,56], "f": 0, "t": 123, "d": [6,200] }, + { "px": [0,88], "src": [88,56], "f": 0, "t": 123, "d": [6,220] }, + { "px": [0,96], "src": [88,56], "f": 0, "t": 123, "d": [6,240] }, + { "px": [128,96], "src": [88,56], "f": 0, "t": 123, "d": [6,256] }, + { "px": [0,104], "src": [88,56], "f": 0, "t": 123, "d": [6,260] }, + { "px": [128,104], "src": [88,56], "f": 0, "t": 123, "d": [6,276] }, + { "px": [0,112], "src": [88,56], "f": 0, "t": 123, "d": [6,280] }, + { "px": [64,0], "src": [56,56], "f": 0, "t": 119, "d": [7,8] }, + { "px": [72,0], "src": [56,56], "f": 0, "t": 119, "d": [7,9] }, + { "px": [80,0], "src": [56,56], "f": 0, "t": 119, "d": [7,10] }, + { "px": [88,0], "src": [56,56], "f": 0, "t": 119, "d": [7,11] }, + { "px": [40,24], "src": [56,56], "f": 0, "t": 119, "d": [7,65] }, + { "px": [48,24], "src": [56,56], "f": 0, "t": 119, "d": [7,66] }, + { "px": [56,24], "src": [56,56], "f": 0, "t": 119, "d": [7,67] }, + { "px": [96,24], "src": [56,56], "f": 0, "t": 119, "d": [7,72] }, + { "px": [104,24], "src": [56,56], "f": 0, "t": 119, "d": [7,73] }, + { "px": [112,24], "src": [56,56], "f": 0, "t": 119, "d": [7,74] }, + { "px": [24,32], "src": [56,56], "f": 0, "t": 119, "d": [7,83] }, + { "px": [128,32], "src": [56,56], "f": 0, "t": 119, "d": [7,96] }, + { "px": [8,72], "src": [56,56], "f": 0, "t": 119, "d": [7,181] }, + { "px": [16,72], "src": [56,56], "f": 0, "t": 119, "d": [7,182] }, + { "px": [24,72], "src": [56,56], "f": 0, "t": 119, "d": [7,183] }, + { "px": [32,72], "src": [56,56], "f": 0, "t": 119, "d": [7,184] }, + { "px": [40,72], "src": [56,56], "f": 0, "t": 119, "d": [7,185] }, + { "px": [48,72], "src": [56,56], "f": 0, "t": 119, "d": [7,186] }, + { "px": [56,72], "src": [56,56], "f": 0, "t": 119, "d": [7,187] }, + { "px": [96,72], "src": [56,56], "f": 0, "t": 119, "d": [7,192] }, + { "px": [104,72], "src": [56,56], "f": 0, "t": 119, "d": [7,193] }, + { "px": [112,72], "src": [56,56], "f": 0, "t": 119, "d": [7,194] }, + { "px": [120,72], "src": [56,56], "f": 0, "t": 119, "d": [7,195] }, + { "px": [128,72], "src": [56,56], "f": 0, "t": 119, "d": [7,196] }, + { "px": [136,72], "src": [56,56], "f": 0, "t": 119, "d": [7,197] }, + { "px": [144,72], "src": [56,56], "f": 0, "t": 119, "d": [7,198] }, + { "px": [32,104], "src": [56,56], "f": 0, "t": 119, "d": [7,264] }, + { "px": [40,104], "src": [56,56], "f": 0, "t": 119, "d": [7,265] }, + { "px": [48,104], "src": [56,56], "f": 0, "t": 119, "d": [7,266] }, + { "px": [56,104], "src": [56,56], "f": 0, "t": 119, "d": [7,267] }, + { "px": [72,104], "src": [56,56], "f": 0, "t": 119, "d": [7,269] }, + { "px": [80,104], "src": [56,56], "f": 0, "t": 119, "d": [7,270] }, + { "px": [88,104], "src": [56,56], "f": 0, "t": 119, "d": [7,271] }, + { "px": [96,104], "src": [56,56], "f": 0, "t": 119, "d": [7,272] }, + { "px": [104,104], "src": [56,56], "f": 0, "t": 119, "d": [7,273] }, + { "px": [112,104], "src": [56,56], "f": 0, "t": 119, "d": [7,274] }, + { "px": [120,104], "src": [56,56], "f": 0, "t": 119, "d": [7,275] }, + { "px": [96,8], "src": [104,56], "f": 0, "t": 125, "d": [8,32] }, + { "px": [96,16], "src": [104,56], "f": 0, "t": 125, "d": [8,52] }, + { "px": [136,40], "src": [104,56], "f": 0, "t": 125, "d": [8,117] }, + { "px": [136,48], "src": [104,56], "f": 0, "t": 125, "d": [8,137] }, + { "px": [88,64], "src": [104,56], "f": 0, "t": 125, "d": [8,171] }, + { "px": [152,80], "src": [104,56], "f": 0, "t": 125, "d": [8,219] }, + { "px": [152,88], "src": [104,56], "f": 0, "t": 125, "d": [8,239] }, + { "px": [24,96], "src": [104,56], "f": 0, "t": 125, "d": [8,243] }, + { "px": [152,96], "src": [104,56], "f": 0, "t": 125, "d": [8,259] }, + { "px": [24,104], "src": [104,56], "f": 0, "t": 125, "d": [8,263] }, + { "px": [152,104], "src": [104,56], "f": 0, "t": 125, "d": [8,279] }, + { "px": [152,112], "src": [104,56], "f": 0, "t": 125, "d": [8,299] }, + { "px": [152,120], "src": [104,56], "f": 0, "t": 125, "d": [8,319] }, + { "px": [152,128], "src": [104,56], "f": 0, "t": 125, "d": [8,339] }, + { "px": [152,136], "src": [104,56], "f": 0, "t": 125, "d": [8,359] }, + { "px": [152,144], "src": [104,56], "f": 0, "t": 125, "d": [8,379] }, + { "px": [64,24], "src": [80,56], "f": 0, "t": 122, "d": [9,68] }, + { "px": [64,56], "src": [80,56], "f": 0, "t": 122, "d": [9,148] }, + { "px": [128,88], "src": [80,56], "f": 0, "t": 122, "d": [9,236] }, + { "px": [32,32], "src": [24,56], "f": 0, "t": 115, "d": [10,84] }, + { "px": [64,72], "src": [24,56], "f": 0, "t": 115, "d": [10,188] }, + { "px": [0,120], "src": [24,56], "f": 0, "t": 115, "d": [10,300] }, + { "px": [64,136], "src": [24,56], "f": 0, "t": 115, "d": [10,348] }, + { "px": [120,32], "src": [40,56], "f": 0, "t": 117, "d": [11,95] }, + { "px": [88,72], "src": [40,56], "f": 0, "t": 117, "d": [11,191] }, + { "px": [88,24], "src": [96,56], "f": 0, "t": 124, "d": [12,71] }, + { "px": [88,56], "src": [96,56], "f": 0, "t": 124, "d": [12,151] }, + { "px": [24,88], "src": [96,56], "f": 0, "t": 124, "d": [12,223] }, + { "px": [56,136], "src": [48,56], "f": 0, "t": 118, "d": [13,347] }, + { "px": [24,112], "src": [72,56], "f": 0, "t": 121, "d": [14,283] }, + { "px": [64,112], "src": [72,56], "f": 0, "t": 121, "d": [14,288] }, + { "px": [128,112], "src": [72,56], "f": 0, "t": 121, "d": [14,296] }, + { "px": [24,120], "src": [72,56], "f": 0, "t": 121, "d": [14,303] }, + { "px": [64,120], "src": [72,56], "f": 0, "t": 121, "d": [14,308] }, + { "px": [128,120], "src": [72,56], "f": 0, "t": 121, "d": [14,316] }, + { "px": [24,128], "src": [72,56], "f": 0, "t": 121, "d": [14,323] }, + { "px": [64,128], "src": [72,56], "f": 0, "t": 121, "d": [14,328] }, + { "px": [128,128], "src": [72,56], "f": 0, "t": 121, "d": [14,336] }, + { "px": [48,136], "src": [32,56], "f": 0, "t": 116, "d": [22,346] }, + { "px": [64,32], "src": [8,56], "f": 0, "t": 113, "d": [23,88] }, + { "px": [88,32], "src": [8,56], "f": 0, "t": 113, "d": [23,91] }, + { "px": [24,136], "src": [8,56], "f": 0, "t": 113, "d": [23,343] }, + { "px": [128,136], "src": [8,56], "f": 0, "t": 113, "d": [23,356] }, + { "px": [72,32], "src": [16,16], "f": 0, "t": 34, "d": [127,89] }, + { "px": [80,32], "src": [16,16], "f": 0, "t": 34, "d": [127,90] }, + { "px": [72,56], "src": [16,16], "f": 0, "t": 34, "d": [127,149] }, + { "px": [80,56], "src": [16,16], "f": 0, "t": 34, "d": [127,150] }, + { "px": [32,136], "src": [16,16], "f": 0, "t": 34, "d": [127,344] }, + { "px": [40,136], "src": [16,16], "f": 0, "t": 34, "d": [127,345] } + ], + "seed": 1103672, + "overrideTilesetUid": null, + "gridTiles": [], + "entityInstances": [] + } + ], + "__neighbours": [ { "levelIid": "a41ac680-02f0-11ed-9529-a35f990f0c1f", "levelUid": 80, "dir": "s" }, { "levelIid": "1cafc6a0-02f0-11ed-9529-dbb478928543", "levelUid": 95, "dir": "w" } ] } ], "worlds": [] diff --git a/src/game.zig b/src/game.zig index 5d47fc8..37afc37 100644 --- a/src/game.zig +++ b/src/game.zig @@ -382,7 +382,7 @@ pub fn start() !void { .map_size = level_size, .bridges = try alloc.alloc(Circuit.BridgeState, 5), .sources = try alloc.alloc(util.Cell, 5), - .doors = try alloc.alloc(Circuit.DoorState, 5), + .doors = try alloc.alloc(Circuit.DoorState, 10), }; circuit = Circuit.init(circuit_options); @@ -390,20 +390,21 @@ pub fn start() !void { db = try world.Database.init(db_alloc); - const spawn = db.getSpawn(); + const spawn_entity = db.getSpawn(); + const spawn = spawn_entity.coord.subC(spawn_entity.coord.toLevelTopLeft()); - const spawn_worldc = spawn.coord.toWorld(); + const spawn_worldc = spawn_entity.coord.toWorld(); const first_level = db.findLevel(spawn_worldc[0], spawn_worldc[1]) orelse return error.SpawnOutOfBounds; try loadLevel(first_level); - camera = @divTrunc(spawn.coord.toVec2(), @splat(2, @as(i32, 20))) * @splat(2, @as(i32, 20)); + camera = @divTrunc(spawn.toVec2(), @splat(2, @as(i32, 20))) * @splat(2, @as(i32, 20)); const tile_size = Vec2{ 8, 8 }; const offset = Vec2{ 4, 8 }; player = .{ - .pos = Pos.init(util.vec2ToVec2f(spawn.coord.toVec2() * tile_size + offset)), + .pos = Pos.init(util.vec2ToVec2f(spawn.toVec2() * tile_size + offset)), .control = .{ .controller = .player, .state = .stand }, .sprite = .{ .offset = .{ -4, -8 }, .size = .{ 8, 8 }, .index = 8, .flags = .{ .bpp = .b2 } }, .physics = .{ .friction = Vec2f{ 0.15, 0.1 }, .gravity = Vec2f{ 0, 0.25 } },