diff --git a/assets/Typical_2D_platformer_example.ldtk b/assets/Typical_2D_platformer_example.ldtk index f361049b..72141595 100755 --- a/assets/Typical_2D_platformer_example.ldtk +++ b/assets/Typical_2D_platformer_example.ldtk @@ -10,7 +10,7 @@ }, "jsonVersion": "1.1.1", "appBuildId": 458278, - "nextUid": 106, + "nextUid": 107, "identifierStyle": "Capitalize", "worldLayout": "Free", "worldGridWidth": 256, @@ -1448,6 +1448,34 @@ "tilesetUid": null } ] + }, + { + "identifier": "Pumpkins", + "uid": 106, + "tags": [], + "width": 48, + "height": 16, + "resizableX": false, + "resizableY": false, + "keepAspectRatio": false, + "tileOpacity": 1, + "fillOpacity": 0.08, + "lineOpacity": 0, + "hollow": false, + "color": "#BE4A2F", + "renderMode": "Tile", + "showName": true, + "tilesetId": 105, + "tileId": 164, + "tileRenderMode": "FitInside", + "tileRect": { "tilesetUid": 105, "x": 128, "y": 320, "w": 96, "h": 32 }, + "nineSliceBorders": [], + "maxCount": 0, + "limitScope": "PerLevel", + "limitBehavior": "MoveLastOne", + "pivotX": 0.5, + "pivotY": 1, + "fieldDefs": [] } ], "tilesets": [ { @@ -1679,6 +1707,20 @@ "defUid": 86, "px": [568,128], "fieldInstances": [{ "__identifier": "locked", "__value": false, "__type": "Bool", "__tile": null, "defUid": 87, "realEditorValues": [] }] + }, + { + "__identifier": "Pumpkins", + "__grid": [42,17], + "__pivot": [0.5,1], + "__tags": [], + "__tile": { "tilesetUid": 105, "x": 128, "y": 320, "w": 96, "h": 32 }, + "__smartColor": "#BE4A2F", + "iid": "6f7e6760-9f30-11ed-b47d-6b8c4f8b2877", + "width": 48, + "height": 16, + "defUid": 106, + "px": [680,288], + "fieldInstances": [] } ] }, @@ -1782,11 +1824,16 @@ { "px": [480,240], "src": [336,112], "f": 0, "t": 182, "d": [99,825] }, { "px": [496,240], "src": [336,112], "f": 0, "t": 182, "d": [99,826] }, { "px": [512,240], "src": [336,112], "f": 0, "t": 182, "d": [99,827] }, + { "px": [656,240], "src": [336,112], "f": 0, "t": 182, "d": [99,836] }, + { "px": [672,240], "src": [336,112], "f": 0, "t": 182, "d": [99,837] }, + { "px": [688,240], "src": [336,112], "f": 0, "t": 182, "d": [99,838] }, { "px": [112,256], "src": [336,112], "f": 0, "t": 182, "d": [99,855] }, { "px": [128,256], "src": [336,112], "f": 0, "t": 182, "d": [99,856] }, { "px": [320,256], "src": [336,112], "f": 2, "t": 182, "d": [99,868] }, { "px": [432,256], "src": [336,112], "f": 0, "t": 182, "d": [99,875] }, { "px": [448,256], "src": [336,112], "f": 0, "t": 182, "d": [99,876] }, + { "px": [640,256], "src": [336,112], "f": 0, "t": 182, "d": [99,888] }, + { "px": [704,256], "src": [336,112], "f": 0, "t": 182, "d": [99,892] }, { "px": [256,272], "src": [336,112], "f": 2, "t": 182, "d": [99,917] }, { "px": [272,272], "src": [336,112], "f": 2, "t": 182, "d": [99,918] }, { "px": [288,272], "src": [336,112], "f": 2, "t": 182, "d": [99,919] }, @@ -1802,6 +1849,11 @@ { "px": [480,272], "src": [336,112], "f": 2, "t": 182, "d": [99,931] }, { "px": [496,272], "src": [336,112], "f": 2, "t": 182, "d": [99,932] }, { "px": [512,272], "src": [336,112], "f": 2, "t": 182, "d": [99,933] }, + { "px": [640,272], "src": [336,112], "f": 2, "t": 182, "d": [99,941] }, + { "px": [656,272], "src": [336,112], "f": 2, "t": 182, "d": [99,942] }, + { "px": [672,272], "src": [336,112], "f": 2, "t": 182, "d": [99,943] }, + { "px": [688,272], "src": [336,112], "f": 2, "t": 182, "d": [99,944] }, + { "px": [704,272], "src": [336,112], "f": 2, "t": 182, "d": [99,945] }, { "px": [128,0], "src": [320,128], "f": 1, "t": 204, "d": [100,8] }, { "px": [128,16], "src": [320,128], "f": 1, "t": 204, "d": [100,61] }, { "px": [128,32], "src": [320,128], "f": 1, "t": 204, "d": [100,114] }, @@ -1859,11 +1911,15 @@ { "px": [416,240], "src": [320,128], "f": 0, "t": 204, "d": [100,821] }, { "px": [464,240], "src": [320,128], "f": 0, "t": 204, "d": [100,824] }, { "px": [512,240], "src": [320,128], "f": 1, "t": 204, "d": [100,827] }, + { "px": [656,240], "src": [320,128], "f": 0, "t": 204, "d": [100,836] }, + { "px": [688,240], "src": [320,128], "f": 1, "t": 204, "d": [100,838] }, { "px": [128,256], "src": [320,128], "f": 1, "t": 204, "d": [100,856] }, { "px": [256,256], "src": [320,128], "f": 0, "t": 204, "d": [100,864] }, { "px": [384,256], "src": [320,128], "f": 1, "t": 204, "d": [100,872] }, { "px": [416,256], "src": [320,128], "f": 0, "t": 204, "d": [100,874] }, { "px": [512,256], "src": [320,128], "f": 1, "t": 204, "d": [100,880] }, + { "px": [640,256], "src": [320,128], "f": 0, "t": 204, "d": [100,888] }, + { "px": [704,256], "src": [320,128], "f": 1, "t": 204, "d": [100,892] }, { "px": [128,272], "src": [320,128], "f": 1, "t": 204, "d": [100,909] }, { "px": [256,272], "src": [320,128], "f": 0, "t": 204, "d": [100,917] }, { "px": [304,272], "src": [320,128], "f": 1, "t": 204, "d": [100,920] }, @@ -1871,6 +1927,8 @@ { "px": [384,272], "src": [320,128], "f": 1, "t": 204, "d": [100,925] }, { "px": [416,272], "src": [320,128], "f": 0, "t": 204, "d": [100,927] }, { "px": [512,272], "src": [320,128], "f": 1, "t": 204, "d": [100,933] }, + { "px": [640,272], "src": [320,128], "f": 0, "t": 204, "d": [100,941] }, + { "px": [704,272], "src": [320,128], "f": 1, "t": 204, "d": [100,945] }, { "px": [128,288], "src": [320,128], "f": 1, "t": 204, "d": [100,962] }, { "px": [128,304], "src": [320,128], "f": 1, "t": 204, "d": [100,1015] }, { "px": [128,320], "src": [320,128], "f": 1, "t": 204, "d": [100,1068] } @@ -1922,11 +1980,11 @@ 1,1,1,1,1,0,0,0,0,0,0,1,1,1,2,1,3,3,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,0,0,0,0,0,0,0,3,3,3,3,1,1,1,1,1,0,0,0,0,0,0,0,1,1,2,1,3, 3,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,3,3,3, - 3,1,1,1,1,1,0,0,0,0,0,0,0,0,0,2,0,3,3,0,0,0,0,3,3,1,1,1,1,1,1,1,1,1,1, + 3,1,1,1,1,1,0,0,0,0,0,0,0,0,0,2,0,3,3,0,0,0,0,3,3,1,1,1,1,1,1,0,0,0,1, 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,3,3,1,1,1,1,1,0,0,0,0,0,0,0,0,0,2,0, - 0,0,0,0,0,0,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,3,3,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1, + 0,0,0,0,0,0,3,3,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0, + 1,1,1,1,1,1,1,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,3,3,1,1,1,1,1,0,0,0,0, + 0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1, 1,3,3,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, 0,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,3,3,3,3,3,3,3,3,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1, @@ -2012,21 +2070,25 @@ { "px": [592,224], "src": [32,32], "f": 0, "t": 48, "d": [13,779] }, { "px": [608,224], "src": [32,32], "f": 0, "t": 48, "d": [13,780] }, { "px": [624,224], "src": [32,32], "f": 0, "t": 48, "d": [13,781] }, - { "px": [672,224], "src": [32,32], "f": 0, "t": 48, "d": [13,784] }, { "px": [768,224], "src": [32,32], "f": 0, "t": 48, "d": [13,790] }, { "px": [224,240], "src": [32,32], "f": 0, "t": 48, "d": [13,809] }, { "px": [576,240], "src": [32,32], "f": 0, "t": 48, "d": [13,831] }, { "px": [592,240], "src": [32,32], "f": 0, "t": 48, "d": [13,832] }, + { "px": [608,240], "src": [32,32], "f": 0, "t": 48, "d": [13,833] }, + { "px": [624,240], "src": [32,32], "f": 0, "t": 48, "d": [13,834] }, { "px": [208,256], "src": [32,32], "f": 0, "t": 48, "d": [13,861] }, { "px": [576,256], "src": [32,32], "f": 0, "t": 48, "d": [13,884] }, { "px": [592,256], "src": [32,32], "f": 0, "t": 48, "d": [13,885] }, + { "px": [608,256], "src": [32,32], "f": 0, "t": 48, "d": [13,886] }, { "px": [208,272], "src": [32,32], "f": 0, "t": 48, "d": [13,914] }, { "px": [576,272], "src": [32,32], "f": 0, "t": 48, "d": [13,937] }, { "px": [592,272], "src": [32,32], "f": 0, "t": 48, "d": [13,938] }, + { "px": [608,272], "src": [32,32], "f": 0, "t": 48, "d": [13,939] }, { "px": [160,288], "src": [32,32], "f": 0, "t": 48, "d": [13,964] }, { "px": [192,288], "src": [32,32], "f": 0, "t": 48, "d": [13,966] }, { "px": [576,288], "src": [32,32], "f": 0, "t": 48, "d": [13,990] }, { "px": [592,288], "src": [32,32], "f": 0, "t": 48, "d": [13,991] }, + { "px": [608,288], "src": [32,32], "f": 0, "t": 48, "d": [13,992] }, { "px": [256,304], "src": [32,32], "f": 0, "t": 48, "d": [13,1023] }, { "px": [352,304], "src": [32,32], "f": 0, "t": 48, "d": [13,1029] }, { "px": [368,304], "src": [32,32], "f": 0, "t": 48, "d": [13,1030] }, @@ -2034,6 +2096,9 @@ { "px": [400,304], "src": [32,32], "f": 0, "t": 48, "d": [13,1032] }, { "px": [576,304], "src": [32,32], "f": 0, "t": 48, "d": [13,1043] }, { "px": [592,304], "src": [32,32], "f": 0, "t": 48, "d": [13,1044] }, + { "px": [608,304], "src": [32,32], "f": 0, "t": 48, "d": [13,1045] }, + { "px": [624,304], "src": [32,32], "f": 0, "t": 48, "d": [13,1046] }, + { "px": [704,304], "src": [32,32], "f": 0, "t": 48, "d": [13,1051] }, { "px": [176,320], "src": [32,32], "f": 0, "t": 48, "d": [13,1071] }, { "px": [240,320], "src": [32,32], "f": 0, "t": 48, "d": [13,1075] }, { "px": [256,320], "src": [32,32], "f": 0, "t": 48, "d": [13,1076] }, @@ -2044,6 +2109,12 @@ { "px": [400,320], "src": [32,32], "f": 0, "t": 48, "d": [13,1085] }, { "px": [576,320], "src": [32,32], "f": 0, "t": 48, "d": [13,1096] }, { "px": [592,320], "src": [32,32], "f": 0, "t": 48, "d": [13,1097] }, + { "px": [608,320], "src": [32,32], "f": 0, "t": 48, "d": [13,1098] }, + { "px": [624,320], "src": [32,32], "f": 0, "t": 48, "d": [13,1099] }, + { "px": [640,320], "src": [32,32], "f": 0, "t": 48, "d": [13,1100] }, + { "px": [656,320], "src": [32,32], "f": 0, "t": 48, "d": [13,1101] }, + { "px": [688,320], "src": [32,32], "f": 0, "t": 48, "d": [13,1103] }, + { "px": [720,320], "src": [32,32], "f": 0, "t": 48, "d": [13,1105] }, { "px": [320,16], "src": [96,96], "f": 0, "t": 144, "d": [81,73] }, { "px": [416,16], "src": [96,96], "f": 0, "t": 144, "d": [81,79] }, { "px": [400,32], "src": [96,96], "f": 0, "t": 144, "d": [81,131] }, @@ -2075,17 +2146,25 @@ { "px": [784,224], "src": [96,96], "f": 0, "t": 144, "d": [81,791] }, { "px": [800,224], "src": [96,96], "f": 0, "t": 144, "d": [81,792] }, { "px": [192,240], "src": [96,96], "f": 0, "t": 144, "d": [81,807] }, + { "px": [736,240], "src": [96,96], "f": 0, "t": 144, "d": [81,841] }, + { "px": [752,240], "src": [96,96], "f": 0, "t": 144, "d": [81,842] }, { "px": [192,256], "src": [96,96], "f": 0, "t": 144, "d": [81,860] }, { "px": [224,256], "src": [96,96], "f": 0, "t": 144, "d": [81,862] }, + { "px": [736,256], "src": [96,96], "f": 0, "t": 144, "d": [81,894] }, { "px": [224,272], "src": [96,96], "f": 0, "t": 144, "d": [81,915] }, + { "px": [752,272], "src": [96,96], "f": 0, "t": 144, "d": [81,948] }, { "px": [176,288], "src": [96,96], "f": 0, "t": 144, "d": [81,965] }, { "px": [240,288], "src": [96,96], "f": 0, "t": 144, "d": [81,969] }, + { "px": [752,288], "src": [96,96], "f": 0, "t": 144, "d": [81,1001] }, { "px": [176,304], "src": [96,96], "f": 0, "t": 144, "d": [81,1018] }, { "px": [192,304], "src": [96,96], "f": 0, "t": 144, "d": [81,1019] }, { "px": [208,304], "src": [96,96], "f": 0, "t": 144, "d": [81,1020] }, { "px": [224,304], "src": [96,96], "f": 0, "t": 144, "d": [81,1021] }, { "px": [240,304], "src": [96,96], "f": 0, "t": 144, "d": [81,1022] }, { "px": [288,304], "src": [96,96], "f": 0, "t": 144, "d": [81,1025] }, + { "px": [656,304], "src": [96,96], "f": 0, "t": 144, "d": [81,1048] }, + { "px": [672,304], "src": [96,96], "f": 0, "t": 144, "d": [81,1049] }, + { "px": [688,304], "src": [96,96], "f": 0, "t": 144, "d": [81,1050] }, { "px": [160,0], "src": [64,96], "f": 0, "t": 142, "d": [14,10] }, { "px": [432,0], "src": [64,96], "f": 0, "t": 142, "d": [14,27] }, { "px": [800,0], "src": [64,96], "f": 0, "t": 142, "d": [14,50] }, @@ -2112,19 +2191,30 @@ { "px": [752,208], "src": [64,96], "f": 0, "t": 142, "d": [14,736] }, { "px": [800,208], "src": [96,96], "f": 0, "t": 144, "d": [14,739] }, { "px": [816,208], "src": [64,96], "f": 0, "t": 142, "d": [14,740] }, - { "px": [656,224], "src": [96,96], "f": 0, "t": 144, "d": [14,783] }, - { "px": [688,224], "src": [64,96], "f": 0, "t": 142, "d": [14,785] }, { "px": [720,224], "src": [64,96], "f": 0, "t": 142, "d": [14,787] }, { "px": [208,240], "src": [96,96], "f": 0, "t": 144, "d": [14,808] }, + { "px": [720,240], "src": [96,96], "f": 0, "t": 144, "d": [14,840] }, + { "px": [752,256], "src": [64,96], "f": 0, "t": 142, "d": [14,895] }, { "px": [176,272], "src": [96,96], "f": 0, "t": 144, "d": [14,912] }, { "px": [192,272], "src": [64,96], "f": 0, "t": 142, "d": [14,913] }, + { "px": [736,272], "src": [96,96], "f": 0, "t": 144, "d": [14,947] }, { "px": [208,288], "src": [64,96], "f": 0, "t": 142, "d": [14,967] }, { "px": [224,288], "src": [64,96], "f": 0, "t": 142, "d": [14,968] }, + { "px": [624,288], "src": [96,96], "f": 0, "t": 144, "d": [14,993] }, + { "px": [720,288], "src": [96,96], "f": 0, "t": 144, "d": [14,999] }, + { "px": [736,288], "src": [96,96], "f": 0, "t": 144, "d": [14,1000] }, { "px": [160,304], "src": [64,96], "f": 0, "t": 142, "d": [14,1017] }, { "px": [272,304], "src": [96,96], "f": 0, "t": 144, "d": [14,1024] }, + { "px": [640,304], "src": [64,96], "f": 0, "t": 142, "d": [14,1047] }, + { "px": [720,304], "src": [96,96], "f": 0, "t": 144, "d": [14,1052] }, + { "px": [736,304], "src": [96,96], "f": 0, "t": 144, "d": [14,1053] }, + { "px": [752,304], "src": [64,96], "f": 0, "t": 142, "d": [14,1054] }, { "px": [160,320], "src": [96,96], "f": 0, "t": 144, "d": [14,1070] }, { "px": [224,320], "src": [64,96], "f": 0, "t": 142, "d": [14,1074] }, { "px": [272,320], "src": [96,96], "f": 0, "t": 144, "d": [14,1077] }, + { "px": [672,320], "src": [64,96], "f": 0, "t": 142, "d": [14,1102] }, + { "px": [704,320], "src": [64,96], "f": 0, "t": 142, "d": [14,1104] }, + { "px": [736,320], "src": [64,96], "f": 0, "t": 142, "d": [14,1106] }, { "px": [144,0], "src": [0,32], "f": 0, "t": 46, "d": [16,9] }, { "px": [560,0], "src": [0,32], "f": 1, "t": 46, "d": [16,35] }, { "px": [784,0], "src": [0,32], "f": 0, "t": 46, "d": [16,49] }, @@ -2171,8 +2261,12 @@ { "px": [176,256], "src": [0,32], "f": 0, "t": 46, "d": [16,859] }, { "px": [240,256], "src": [0,32], "f": 1, "t": 46, "d": [16,863] }, { "px": [560,256], "src": [0,32], "f": 0, "t": 46, "d": [16,883] }, + { "px": [624,256], "src": [0,32], "f": 1, "t": 46, "d": [16,887] }, + { "px": [720,256], "src": [0,32], "f": 0, "t": 46, "d": [16,893] }, { "px": [240,272], "src": [0,32], "f": 1, "t": 46, "d": [16,916] }, { "px": [560,272], "src": [0,32], "f": 0, "t": 46, "d": [16,936] }, + { "px": [624,272], "src": [0,32], "f": 1, "t": 46, "d": [16,940] }, + { "px": [720,272], "src": [0,32], "f": 0, "t": 46, "d": [16,946] }, { "px": [144,288], "src": [0,32], "f": 0, "t": 46, "d": [16,963] }, { "px": [560,288], "src": [0,32], "f": 0, "t": 46, "d": [16,989] }, { "px": [144,304], "src": [0,32], "f": 0, "t": 46, "d": [16,1016] }, @@ -2209,6 +2303,8 @@ { "px": [512,176], "src": [32,64], "f": 0, "t": 94, "d": [18,615] }, { "px": [528,176], "src": [32,64], "f": 0, "t": 94, "d": [18,616] }, { "px": [544,176], "src": [32,64], "f": 0, "t": 94, "d": [18,617] }, + { "px": [656,224], "src": [32,64], "f": 0, "t": 94, "d": [18,783] }, + { "px": [688,224], "src": [32,64], "f": 0, "t": 94, "d": [18,785] }, { "px": [320,32], "src": [0,64], "f": 0, "t": 92, "d": [17,126] }, { "px": [480,32], "src": [0,64], "f": 1, "t": 92, "d": [17,136] }, { "px": [560,32], "src": [0,64], "f": 1, "t": 92, "d": [17,141] }, @@ -2225,6 +2321,8 @@ { "px": [368,224], "src": [0,64], "f": 0, "t": 92, "d": [17,765] }, { "px": [384,224], "src": [0,64], "f": 1, "t": 92, "d": [17,766] }, { "px": [416,224], "src": [0,64], "f": 0, "t": 92, "d": [17,768] }, + { "px": [640,240], "src": [0,64], "f": 1, "t": 92, "d": [17,835] }, + { "px": [704,240], "src": [0,64], "f": 0, "t": 92, "d": [17,839] }, { "px": [496,32], "src": [48,160], "f": 0, "t": 233, "d": [29,137] }, { "px": [352,48], "src": [48,160], "f": 1, "t": 233, "d": [29,181] }, { "px": [464,48], "src": [48,160], "f": 0, "t": 233, "d": [29,188] }, @@ -2233,6 +2331,10 @@ { "px": [432,64], "src": [48,160], "f": 0, "t": 233, "d": [29,239] }, { "px": [256,112], "src": [64,144], "f": 0, "t": 211, "d": [29,387] }, { "px": [352,224], "src": [64,144], "f": 1, "t": 211, "d": [29,764] }, + { "px": [656,240], "src": [48,160], "f": 0, "t": 233, "d": [29,836] }, + { "px": [688,240], "src": [64,144], "f": 1, "t": 211, "d": [29,838] }, + { "px": [640,256], "src": [64,144], "f": 0, "t": 211, "d": [29,888] }, + { "px": [704,256], "src": [48,160], "f": 1, "t": 233, "d": [29,892] }, { "px": [320,32], "src": [64,224], "f": 2, "t": 326, "d": [31,126] }, { "px": [480,32], "src": [64,224], "f": 3, "t": 326, "d": [31,136] }, { "px": [560,32], "src": [64,224], "f": 3, "t": 326, "d": [31,141] }, @@ -2249,6 +2351,8 @@ { "px": [368,224], "src": [64,224], "f": 2, "t": 326, "d": [31,765] }, { "px": [384,224], "src": [64,224], "f": 3, "t": 326, "d": [31,766] }, { "px": [416,224], "src": [64,224], "f": 2, "t": 326, "d": [31,768] }, + { "px": [640,240], "src": [64,224], "f": 3, "t": 326, "d": [31,835] }, + { "px": [704,240], "src": [64,224], "f": 2, "t": 326, "d": [31,839] }, { "px": [256,16], "src": [64,144], "f": 3, "t": 211, "d": [32,69] }, { "px": [320,16], "src": [64,144], "f": 2, "t": 211, "d": [32,73] }, { "px": [480,16], "src": [64,144], "f": 3, "t": 211, "d": [32,83] }, @@ -2266,8 +2370,14 @@ { "px": [560,192], "src": [64,144], "f": 1, "t": 211, "d": [32,671] }, { "px": [784,192], "src": [64,144], "f": 0, "t": 211, "d": [32,685] }, { "px": [368,208], "src": [64,144], "f": 2, "t": 211, "d": [32,712] }, + { "px": [640,224], "src": [64,144], "f": 3, "t": 211, "d": [32,782] }, + { "px": [704,224], "src": [64,144], "f": 2, "t": 211, "d": [32,786] }, + { "px": [624,240], "src": [64,144], "f": 3, "t": 211, "d": [32,834] }, + { "px": [720,240], "src": [64,144], "f": 2, "t": 211, "d": [32,840] }, { "px": [176,272], "src": [64,144], "f": 0, "t": 211, "d": [32,912] }, { "px": [240,288], "src": [64,144], "f": 1, "t": 211, "d": [32,969] }, + { "px": [624,288], "src": [64,144], "f": 1, "t": 211, "d": [32,993] }, + { "px": [720,288], "src": [64,144], "f": 0, "t": 211, "d": [32,999] }, { "px": [272,80], "src": [32,0], "f": 0, "t": 2, "d": [12,282] }, { "px": [368,160], "src": [32,0], "f": 0, "t": 2, "d": [12,553] }, { "px": [384,160], "src": [32,0], "f": 0, "t": 2, "d": [12,554] }, @@ -2311,7 +2421,14 @@ { "px": [384,288], "src": [32,0], "f": 0, "t": 2, "d": [12,978] }, { "px": [400,288], "src": [32,0], "f": 0, "t": 2, "d": [12,979] }, { "px": [416,288], "src": [32,0], "f": 0, "t": 2, "d": [12,980] }, + { "px": [640,288], "src": [32,0], "f": 0, "t": 2, "d": [12,994] }, + { "px": [656,288], "src": [32,0], "f": 0, "t": 2, "d": [12,995] }, + { "px": [672,288], "src": [32,0], "f": 0, "t": 2, "d": [12,996] }, + { "px": [688,288], "src": [32,0], "f": 0, "t": 2, "d": [12,997] }, + { "px": [704,288], "src": [32,0], "f": 0, "t": 2, "d": [12,998] }, { "px": [256,272], "src": [192,0], "f": 1, "t": 12, "d": [36,917] }, + { "px": [640,272], "src": [192,0], "f": 1, "t": 12, "d": [36,941] }, + { "px": [704,272], "src": [192,0], "f": 0, "t": 12, "d": [36,945] }, { "px": [592,0], "src": [256,128], "f": 0, "t": 200, "d": [58,37] }, { "px": [608,0], "src": [256,128], "f": 0, "t": 200, "d": [58,38] }, { "px": [624,0], "src": [256,128], "f": 0, "t": 200, "d": [58,39] }, @@ -2522,6 +2639,9 @@ { "px": [256,128], "src": [128,96], "f": 0, "t": 146, "d": [22,440] }, { "px": [336,192], "src": [128,96], "f": 1, "t": 146, "d": [22,657] }, { "px": [256,208], "src": [128,96], "f": 0, "t": 146, "d": [22,705] }, + { "px": [672,224], "src": [128,192], "f": 0, "t": 284, "d": [73,784] }, + { "px": [672,240], "src": [128,208], "f": 0, "t": 307, "d": [73,784] }, + { "px": [672,256], "src": [128,224], "f": 0, "t": 330, "d": [73,784] }, { "px": [336,48], "src": [128,224], "f": 0, "t": 330, "d": [35,180] }, { "px": [480,48], "src": [160,208], "f": 0, "t": 309, "d": [35,189] }, { "px": [272,112], "src": [128,224], "f": 0, "t": 330, "d": [35,388] }, @@ -2576,76 +2696,26 @@ { "px": [832,208], "src": [32,32], "f": 0, "t": 48, "d": [102,741] }, { "px": [816,224], "src": [32,32], "f": 0, "t": 48, "d": [102,793] }, { "px": [832,224], "src": [32,32], "f": 0, "t": 48, "d": [102,794] }, - { "px": [608,240], "src": [32,32], "f": 0, "t": 48, "d": [102,833] }, - { "px": [624,240], "src": [32,32], "f": 0, "t": 48, "d": [102,834] }, - { "px": [640,240], "src": [32,32], "f": 0, "t": 48, "d": [102,835] }, - { "px": [656,240], "src": [32,32], "f": 0, "t": 48, "d": [102,836] }, - { "px": [672,240], "src": [32,32], "f": 0, "t": 48, "d": [102,837] }, - { "px": [688,240], "src": [32,32], "f": 0, "t": 48, "d": [102,838] }, - { "px": [704,240], "src": [32,32], "f": 0, "t": 48, "d": [102,839] }, - { "px": [720,240], "src": [32,32], "f": 0, "t": 48, "d": [102,840] }, - { "px": [736,240], "src": [32,32], "f": 0, "t": 48, "d": [102,841] }, - { "px": [752,240], "src": [32,32], "f": 0, "t": 48, "d": [102,842] }, { "px": [768,240], "src": [32,32], "f": 0, "t": 48, "d": [102,843] }, { "px": [784,240], "src": [32,32], "f": 0, "t": 48, "d": [102,844] }, { "px": [800,240], "src": [32,32], "f": 0, "t": 48, "d": [102,845] }, { "px": [816,240], "src": [32,32], "f": 0, "t": 48, "d": [102,846] }, { "px": [832,240], "src": [32,32], "f": 0, "t": 48, "d": [102,847] }, - { "px": [608,256], "src": [32,32], "f": 0, "t": 48, "d": [102,886] }, - { "px": [624,256], "src": [32,32], "f": 0, "t": 48, "d": [102,887] }, - { "px": [640,256], "src": [32,32], "f": 0, "t": 48, "d": [102,888] }, - { "px": [656,256], "src": [32,32], "f": 0, "t": 48, "d": [102,889] }, - { "px": [672,256], "src": [32,32], "f": 0, "t": 48, "d": [102,890] }, - { "px": [688,256], "src": [32,32], "f": 0, "t": 48, "d": [102,891] }, - { "px": [704,256], "src": [32,32], "f": 0, "t": 48, "d": [102,892] }, - { "px": [720,256], "src": [32,32], "f": 0, "t": 48, "d": [102,893] }, - { "px": [736,256], "src": [32,32], "f": 0, "t": 48, "d": [102,894] }, - { "px": [752,256], "src": [32,32], "f": 0, "t": 48, "d": [102,895] }, { "px": [768,256], "src": [32,32], "f": 0, "t": 48, "d": [102,896] }, { "px": [784,256], "src": [32,32], "f": 0, "t": 48, "d": [102,897] }, { "px": [800,256], "src": [32,32], "f": 0, "t": 48, "d": [102,898] }, { "px": [816,256], "src": [32,32], "f": 0, "t": 48, "d": [102,899] }, { "px": [832,256], "src": [32,32], "f": 0, "t": 48, "d": [102,900] }, - { "px": [608,272], "src": [32,32], "f": 0, "t": 48, "d": [102,939] }, - { "px": [624,272], "src": [32,32], "f": 0, "t": 48, "d": [102,940] }, - { "px": [640,272], "src": [32,32], "f": 0, "t": 48, "d": [102,941] }, - { "px": [656,272], "src": [32,32], "f": 0, "t": 48, "d": [102,942] }, - { "px": [672,272], "src": [32,32], "f": 0, "t": 48, "d": [102,943] }, - { "px": [688,272], "src": [32,32], "f": 0, "t": 48, "d": [102,944] }, - { "px": [704,272], "src": [32,32], "f": 0, "t": 48, "d": [102,945] }, - { "px": [720,272], "src": [32,32], "f": 0, "t": 48, "d": [102,946] }, - { "px": [736,272], "src": [32,32], "f": 0, "t": 48, "d": [102,947] }, - { "px": [752,272], "src": [32,32], "f": 0, "t": 48, "d": [102,948] }, { "px": [768,272], "src": [32,32], "f": 0, "t": 48, "d": [102,949] }, { "px": [784,272], "src": [32,32], "f": 0, "t": 48, "d": [102,950] }, { "px": [800,272], "src": [32,32], "f": 0, "t": 48, "d": [102,951] }, { "px": [816,272], "src": [32,32], "f": 0, "t": 48, "d": [102,952] }, { "px": [832,272], "src": [32,32], "f": 0, "t": 48, "d": [102,953] }, - { "px": [608,288], "src": [32,32], "f": 0, "t": 48, "d": [102,992] }, - { "px": [624,288], "src": [32,32], "f": 0, "t": 48, "d": [102,993] }, - { "px": [640,288], "src": [32,32], "f": 0, "t": 48, "d": [102,994] }, - { "px": [656,288], "src": [32,32], "f": 0, "t": 48, "d": [102,995] }, - { "px": [672,288], "src": [32,32], "f": 0, "t": 48, "d": [102,996] }, - { "px": [688,288], "src": [32,32], "f": 0, "t": 48, "d": [102,997] }, - { "px": [704,288], "src": [32,32], "f": 0, "t": 48, "d": [102,998] }, - { "px": [720,288], "src": [32,32], "f": 0, "t": 48, "d": [102,999] }, - { "px": [736,288], "src": [32,32], "f": 0, "t": 48, "d": [102,1000] }, - { "px": [752,288], "src": [32,32], "f": 0, "t": 48, "d": [102,1001] }, { "px": [768,288], "src": [32,32], "f": 0, "t": 48, "d": [102,1002] }, { "px": [784,288], "src": [32,32], "f": 0, "t": 48, "d": [102,1003] }, { "px": [800,288], "src": [32,32], "f": 0, "t": 48, "d": [102,1004] }, { "px": [816,288], "src": [32,32], "f": 0, "t": 48, "d": [102,1005] }, { "px": [832,288], "src": [32,32], "f": 0, "t": 48, "d": [102,1006] }, - { "px": [608,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1045] }, - { "px": [624,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1046] }, - { "px": [640,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1047] }, - { "px": [656,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1048] }, - { "px": [672,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1049] }, - { "px": [688,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1050] }, - { "px": [704,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1051] }, - { "px": [720,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1052] }, - { "px": [736,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1053] }, - { "px": [752,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1054] }, { "px": [768,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1055] }, { "px": [784,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1056] }, { "px": [800,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1057] }, @@ -2653,15 +2723,6 @@ { "px": [832,304], "src": [32,32], "f": 0, "t": 48, "d": [102,1059] }, { "px": [192,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1072] }, { "px": [208,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1073] }, - { "px": [608,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1098] }, - { "px": [624,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1099] }, - { "px": [640,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1100] }, - { "px": [656,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1101] }, - { "px": [672,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1102] }, - { "px": [688,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1103] }, - { "px": [704,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1104] }, - { "px": [720,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1105] }, - { "px": [736,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1106] }, { "px": [752,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1107] }, { "px": [768,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1108] }, { "px": [784,320], "src": [32,32], "f": 0, "t": 48, "d": [102,1109] }, @@ -2982,6 +3043,9 @@ { "px": [464,256], "src": [320,272], "f": 0, "t": 411, "d": [26,877] }, { "px": [480,256], "src": [320,272], "f": 0, "t": 411, "d": [26,878] }, { "px": [496,256], "src": [320,272], "f": 0, "t": 411, "d": [26,879] }, + { "px": [656,256], "src": [320,272], "f": 0, "t": 411, "d": [26,889] }, + { "px": [672,256], "src": [320,272], "f": 0, "t": 411, "d": [26,890] }, + { "px": [688,256], "src": [320,272], "f": 0, "t": 411, "d": [26,891] }, { "px": [0,272], "src": [320,272], "f": 0, "t": 411, "d": [26,901] }, { "px": [16,272], "src": [320,272], "f": 0, "t": 411, "d": [26,902] }, { "px": [32,272], "src": [320,272], "f": 0, "t": 411, "d": [26,903] }, @@ -3060,6 +3124,8 @@ { "px": [384,256], "src": [288,240], "f": 1, "t": 363, "d": [37,872] }, { "px": [416,256], "src": [288,240], "f": 0, "t": 363, "d": [37,874] }, { "px": [512,256], "src": [288,240], "f": 1, "t": 363, "d": [37,880] }, + { "px": [640,256], "src": [288,240], "f": 0, "t": 363, "d": [37,888] }, + { "px": [704,256], "src": [288,240], "f": 1, "t": 363, "d": [37,892] }, { "px": [128,272], "src": [288,240], "f": 1, "t": 363, "d": [37,909] }, { "px": [256,272], "src": [288,240], "f": 0, "t": 363, "d": [37,917] }, { "px": [384,272], "src": [288,240], "f": 1, "t": 363, "d": [37,925] }, @@ -3088,8 +3154,12 @@ { "px": [208,192], "src": [288,272], "f": 0, "t": 409, "d": [38,649] }, { "px": [224,192], "src": [288,272], "f": 0, "t": 409, "d": [38,650] }, { "px": [416,240], "src": [288,272], "f": 2, "t": 409, "d": [38,821] }, + { "px": [656,240], "src": [288,272], "f": 2, "t": 409, "d": [38,836] }, + { "px": [672,240], "src": [288,272], "f": 2, "t": 409, "d": [38,837] }, { "px": [480,272], "src": [288,272], "f": 0, "t": 409, "d": [38,931] }, { "px": [496,272], "src": [288,272], "f": 0, "t": 409, "d": [38,932] }, + { "px": [656,272], "src": [288,272], "f": 0, "t": 409, "d": [38,942] }, + { "px": [688,272], "src": [288,272], "f": 0, "t": 409, "d": [38,944] }, { "px": [16,32], "src": [256,240], "f": 0, "t": 361, "d": [77,108] }, { "px": [32,32], "src": [272,240], "f": 0, "t": 362, "d": [77,108] }, { "px": [48,32], "src": [288,240], "f": 0, "t": 363, "d": [77,108] }, @@ -3114,6 +3184,12 @@ { "px": [320,176], "src": [144,320], "f": 2, "t": 469, "d": [71,604] }, { "px": [336,192], "src": [160,304], "f": 2, "t": 447, "d": [71,604] }, { "px": [336,176], "src": [160,320], "f": 2, "t": 470, "d": [71,604] }, + { "px": [672,256], "src": [128,304], "f": 0, "t": 445, "d": [71,945] }, + { "px": [672,272], "src": [128,320], "f": 0, "t": 468, "d": [71,945] }, + { "px": [688,256], "src": [144,304], "f": 0, "t": 446, "d": [71,945] }, + { "px": [688,272], "src": [144,320], "f": 0, "t": 469, "d": [71,945] }, + { "px": [704,256], "src": [160,304], "f": 0, "t": 447, "d": [71,945] }, + { "px": [704,272], "src": [160,320], "f": 0, "t": 470, "d": [71,945] }, { "px": [352,48], "src": [176,272], "f": 2, "t": 402, "d": [39,181] }, { "px": [528,48], "src": [144,272], "f": 2, "t": 400, "d": [39,192] }, { "px": [512,64], "src": [192,304], "f": 2, "t": 449, "d": [39,244] }, @@ -3128,10 +3204,13 @@ { "px": [448,144], "src": [144,272], "f": 0, "t": 400, "d": [39,505] }, { "px": [464,144], "src": [160,304], "f": 0, "t": 447, "d": [39,506] }, { "px": [496,144], "src": [176,272], "f": 0, "t": 402, "d": [39,508] }, + { "px": [688,240], "src": [176,272], "f": 2, "t": 402, "d": [39,838] }, { "px": [288,272], "src": [160,304], "f": 0, "t": 447, "d": [39,919] }, { "px": [336,272], "src": [176,272], "f": 0, "t": 402, "d": [39,922] }, { "px": [352,272], "src": [160,304], "f": 0, "t": 447, "d": [39,923] }, { "px": [416,272], "src": [176,272], "f": 0, "t": 402, "d": [39,927] }, + { "px": [640,272], "src": [176,272], "f": 0, "t": 402, "d": [39,941] }, + { "px": [672,272], "src": [144,272], "f": 0, "t": 400, "d": [39,943] }, { "px": [464,48], "src": [144,272], "f": 3, "t": 400, "d": [65,188] }, { "px": [384,64], "src": [128,320], "f": 2, "t": 468, "d": [65,236] }, { "px": [256,112], "src": [144,272], "f": 3, "t": 400, "d": [65,387] }, diff --git a/examples/platformer/components.rs b/examples/platformer/components.rs index 98a39e24..35af8ad3 100644 --- a/examples/platformer/components.rs +++ b/examples/platformer/components.rs @@ -240,6 +240,13 @@ pub struct ChestBundle { pub collider_bundle: ColliderBundle, } +#[derive(Clone, Default, Bundle, LdtkEntity)] +pub struct PumpkinsBundle { + #[sprite_sheet_bundle(no_grid)] + #[bundle] + pub sprite_sheet_bundle: SpriteSheetBundle, +} + #[derive(Clone, Default, Component)] pub struct GroundDetection { pub on_ground: bool, diff --git a/examples/platformer/main.rs b/examples/platformer/main.rs index 0763702a..3a973a5a 100644 --- a/examples/platformer/main.rs +++ b/examples/platformer/main.rs @@ -45,5 +45,6 @@ fn main() { .register_ldtk_entity::("Player") .register_ldtk_entity::("Mob") .register_ldtk_entity::("Chest") + .register_ldtk_entity::("Pumpkins") .run(); } diff --git a/macros/src/ldtk_entity.rs b/macros/src/ldtk_entity.rs index 97bd40d0..787593c2 100644 --- a/macros/src/ldtk_entity.rs +++ b/macros/src/ldtk_entity.rs @@ -244,12 +244,24 @@ fn expand_sprite_sheet_bundle_attribute( }, } }, + syn::Meta::List(syn::MetaList { nested, .. }) if nested.len() == 1 => { + let mut nested_iter = nested.iter(); + + match nested_iter.next() { + Some(syn::NestedMeta::Meta(syn::Meta::Path(path))) if path.is_ident("no_grid") => {}, + _ => panic!("Argument of #[sprite_sheet_bundle(...)] should be no_grid") + }; + + quote! { + #field_name: bevy_ecs_ldtk::utils::sprite_sheet_bundle_from_entity_info(entity_instance, tileset, tileset_definition, texture_atlases, false), + } + }, syn::Meta::Path(_) => { quote! { - #field_name: bevy_ecs_ldtk::utils::sprite_sheet_bundle_from_entity_info(entity_instance, tileset, tileset_definition, texture_atlases), + #field_name: bevy_ecs_ldtk::utils::sprite_sheet_bundle_from_entity_info(entity_instance, tileset, tileset_definition, texture_atlases, true), } }, - _ => panic!("#[sprite_sheet_bundle...] attribute should take the form #[sprite_sheet_bundle(\"asset/path.png\", tile_width, tile_height, columns, rows, padding, offset, index)] or #[sprite_sheet_bundle]"), + _ => panic!("#[sprite_sheet_bundle...] attribute should take the form #[sprite_sheet_bundle(\"asset/path.png\", tile_width, tile_height, columns, rows, padding, offset, index)], #[sprite_sheet_bundle(no_grid)] or #[sprite_sheet_bundle]"), } } diff --git a/src/app/ldtk_entity.rs b/src/app/ldtk_entity.rs index 2942d2af..d0c74235 100644 --- a/src/app/ldtk_entity.rs +++ b/src/app/ldtk_entity.rs @@ -10,6 +10,9 @@ use std::{collections::HashMap, marker::PhantomData}; /// [Bundle]: bevy::prelude::Bundle /// [App]: bevy::prelude::App /// [Component]: bevy::prelude::Component +/// [SpriteBundle]: bevy::prelude::SpriteBundle +/// [SpriteSheetBundle]: bevy::prelude::SpriteSheetBundle +/// [TextureAtlas]: bevy::prelude::TextureAtlas /// /// Provides a constructor which can be used for spawning entities from an LDtk file. /// @@ -104,6 +107,10 @@ use std::{collections::HashMap, marker::PhantomData}; /// Similar to using [TextureAtlas::from_grid()]. /// - `#[sprite_sheet_bundle]` will create the field using information from the LDtk Editor visual, /// if it has one. +/// - `#[sprite_sheet_bundle(no_grid)]` will create the field using information from the LDtk +/// Editor visual, if it has one, but without using a grid. Instead a single texture will be used. +/// This may be useful if the LDtk entity's visual uses a rectangle of tiles from its tileset, +/// but will prevent using the generated [TextureAtlas] for animation purposes. /// ``` /// # use bevy::prelude::*; /// # use bevy_ecs_ldtk::prelude::*; @@ -346,6 +353,7 @@ impl LdtkEntity for SpriteSheetBundle { tileset, tileset_definition, texture_atlases, + true, ) } } diff --git a/src/utils.rs b/src/utils.rs index 8b4f6d23..78bf967e 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -314,22 +314,47 @@ pub fn sprite_sheet_bundle_from_entity_info( tileset: Option<&Handle>, tileset_definition: Option<&TilesetDefinition>, texture_atlases: &mut Assets, + grid: bool, ) -> SpriteSheetBundle { match (tileset, &entity_instance.tile, tileset_definition) { (Some(tileset), Some(tile), Some(tileset_definition)) => SpriteSheetBundle { - texture_atlas: texture_atlases.add(TextureAtlas::from_grid( - tileset.clone(), - Vec2::new(tile.w as f32, tile.h as f32), - tileset_definition.c_wid as usize, - tileset_definition.c_hei as usize, - Some(Vec2::splat(tileset_definition.spacing as f32)), - Some(Vec2::splat(tileset_definition.padding as f32)), - )), - sprite: TextureAtlasSprite { - index: (tile.y / (tile.h + tileset_definition.spacing)) as usize - * tileset_definition.c_wid as usize - + (tile.x / (tile.w + tileset_definition.spacing)) as usize, - ..Default::default() + texture_atlas: if grid { + texture_atlases.add(TextureAtlas::from_grid( + tileset.clone(), + Vec2::new(tile.w as f32, tile.h as f32), + tileset_definition.c_wid as usize, + tileset_definition.c_hei as usize, + Some(Vec2::splat(tileset_definition.spacing as f32)), + Some(Vec2::splat(tileset_definition.padding as f32)), + )) + } else { + let mut texture_atlas = TextureAtlas::new_empty( + tileset.clone(), + Vec2::new( + tileset_definition.px_wid as f32, + tileset_definition.px_hei as f32, + ), + ); + texture_atlas.add_texture(Rect::new( + tile.x as f32, + tile.y as f32, + (tile.x + tile.w) as f32, + (tile.y + tile.h) as f32, + )); + texture_atlases.add(texture_atlas) + }, + sprite: if grid { + TextureAtlasSprite { + index: (tile.y / (tile.h + tileset_definition.spacing)) as usize + * tileset_definition.c_wid as usize + + (tile.x / (tile.w + tileset_definition.spacing)) as usize, + ..Default::default() + } + } else { + TextureAtlasSprite { + index: 0, + ..Default::default() + } }, ..Default::default() },