This commit is contained in:
Rowan 2024-05-22 01:48:43 -04:00
parent 399198a76a
commit 3537cff540
6 changed files with 663 additions and 124 deletions

View file

@ -11,7 +11,7 @@
"iid": "e1f10300-fec0-11ee-aa65-4dc22f7ac0b0",
"jsonVersion": "1.5.3",
"appBuildId": 476670,
"nextUid": 34,
"nextUid": 71,
"identifierStyle": "Capitalize",
"toc": [],
"worldLayout": "Free",
@ -134,27 +134,339 @@
"parallaxScaling": true,
"requiredTags": [],
"excludedTags": [],
"autoTilesKilledByOtherLayerUid": null,
"autoTilesKilledByOtherLayerUid": 48,
"uiFilterTags": [],
"useAsyncRender": false,
"intGridValues": [
{ "value": 1, "identifier": null, "color": "#000000", "tile": { "tilesetUid": 7, "x": 0, "y": 0, "w": 16, "h": 16 }, "groupUid": 0 },
{ "value": 2, "identifier": null, "color": "#BE4A2F", "tile": { "tilesetUid": 7, "x": 0, "y": 16, "w": 16, "h": 16 }, "groupUid": 0 },
{ "value": 3, "identifier": null, "color": "#D77643", "tile": { "tilesetUid": 7, "x": 16, "y": 0, "w": 16, "h": 16 }, "groupUid": 0 },
{ "value": 4, "identifier": null, "color": "#EAD4AA", "tile": { "tilesetUid": 7, "x": 16, "y": 16, "w": 16, "h": 16 }, "groupUid": 0 }
{ "value": 1, "identifier": "Grass", "color": "#63C74D", "tile": null, "groupUid": 0 },
{ "value": 2, "identifier": "Bridge", "color": "#BE4A2F", "tile": null, "groupUid": 0 }
],
"intGridValuesGroups": [],
"autoRuleGroups": [
{
"uid": 29,
"name": "New group",
"uid": 68,
"name": "Bridge",
"color": null,
"icon": null,
"active": true,
"isOptional": false,
"rules": [
{
"uid": 30,
"uid": 69,
"active": true,
"size": 3,
"tileRectsIds": [[9]],
"alpha": 1,
"chance": 1,
"breakOnMatch": true,
"pattern": [0,-2,0,-2,2,0,0,-2,0],
"flipX": true,
"flipY": false,
"xModulo": 1,
"yModulo": 1,
"xOffset": 0,
"yOffset": 0,
"tileXOffset": 0,
"tileYOffset": 0,
"tileRandomXMin": 0,
"tileRandomXMax": 0,
"tileRandomYMin": 0,
"tileRandomYMax": 0,
"checker": "None",
"tileMode": "Single",
"pivotX": 0,
"pivotY": 0,
"outOfBoundsValue": 2,
"invalidated": false,
"perlinActive": false,
"perlinSeed": 2168058,
"perlinScale": 0.2,
"perlinOctaves": 2
},
{
"uid": 70,
"active": true,
"size": 3,
"tileRectsIds": [[10]],
"alpha": 1,
"chance": 1,
"breakOnMatch": true,
"pattern": [0,-2,0,0,2,0,0,-2,0],
"flipX": false,
"flipY": false,
"xModulo": 1,
"yModulo": 1,
"xOffset": 0,
"yOffset": 0,
"tileXOffset": 0,
"tileYOffset": 0,
"tileRandomXMin": 0,
"tileRandomXMax": 0,
"tileRandomYMin": 0,
"tileRandomYMax": 0,
"checker": "None",
"tileMode": "Single",
"pivotX": 0,
"pivotY": 0,
"outOfBoundsValue": 2,
"invalidated": false,
"perlinActive": false,
"perlinSeed": 8177156,
"perlinScale": 0.2,
"perlinOctaves": 2
}
],
"usesWizard": true,
"requiredBiomeValues": [],
"biomeRequirementMode": 0
},
{
"uid": 54,
"name": "Rules for #1",
"color": null,
"icon": null,
"active": true,
"isOptional": false,
"rules": [
{
"uid": 55,
"active": true,
"size": 3,
"tileRectsIds": [[0]],
"alpha": 1,
"chance": 1,
"breakOnMatch": true,
"pattern": [0,-1,0,-1,1,0,0,0,0],
"flipX": true,
"flipY": false,
"xModulo": 1,
"yModulo": 1,
"xOffset": 0,
"yOffset": 0,
"tileXOffset": 0,
"tileYOffset": 0,
"tileRandomXMin": 0,
"tileRandomXMax": 0,
"tileRandomYMin": 0,
"tileRandomYMax": 0,
"checker": "None",
"tileMode": "Single",
"pivotX": 0,
"pivotY": 0,
"outOfBoundsValue": 1,
"invalidated": false,
"perlinActive": false,
"perlinSeed": 7945113,
"perlinScale": 0.2,
"perlinOctaves": 2
},
{
"uid": 56,
"active": true,
"size": 3,
"tileRectsIds": [ [1], [16], [17] ],
"alpha": 1,
"chance": 1,
"breakOnMatch": true,
"pattern": [0,0,0,-1,1,0,0,-1,0],
"flipX": true,
"flipY": false,
"xModulo": 1,
"yModulo": 1,
"xOffset": 0,
"yOffset": 0,
"tileXOffset": 0,
"tileYOffset": 0,
"tileRandomXMin": 0,
"tileRandomXMax": 0,
"tileRandomYMin": 0,
"tileRandomYMax": 0,
"checker": "None",
"tileMode": "Single",
"pivotX": 0,
"pivotY": 0,
"outOfBoundsValue": 1,
"invalidated": false,
"perlinActive": false,
"perlinSeed": 6516951,
"perlinScale": 0.2,
"perlinOctaves": 2
},
{
"uid": 57,
"active": true,
"size": 3,
"tileRectsIds": [[0]],
"alpha": 1,
"chance": 1,
"breakOnMatch": true,
"pattern": [0,-1,0,0,1,0,0,0,0],
"flipX": false,
"flipY": false,
"xModulo": 1,
"yModulo": 1,
"xOffset": 0,
"yOffset": 0,
"tileXOffset": 0,
"tileYOffset": 0,
"tileRandomXMin": 0,
"tileRandomXMax": 0,
"tileRandomYMin": 0,
"tileRandomYMax": 0,
"checker": "None",
"tileMode": "Single",
"pivotX": 0,
"pivotY": 0,
"outOfBoundsValue": 1,
"invalidated": false,
"perlinActive": false,
"perlinSeed": 9101503,
"perlinScale": 0.2,
"perlinOctaves": 2
},
{
"uid": 58,
"active": true,
"size": 3,
"tileRectsIds": [ [1], [16], [17] ],
"alpha": 1,
"chance": 1,
"breakOnMatch": true,
"pattern": [0,0,0,0,1,0,0,-1,0],
"flipX": false,
"flipY": false,
"xModulo": 1,
"yModulo": 1,
"xOffset": 0,
"yOffset": 0,
"tileXOffset": 0,
"tileYOffset": 0,
"tileRandomXMin": 0,
"tileRandomXMax": 0,
"tileRandomYMin": 0,
"tileRandomYMax": 0,
"checker": "None",
"tileMode": "Single",
"pivotX": 0,
"pivotY": 0,
"outOfBoundsValue": 1,
"invalidated": false,
"perlinActive": false,
"perlinSeed": 5089140,
"perlinScale": 0.2,
"perlinOctaves": 2
},
{
"uid": 59,
"active": true,
"size": 3,
"tileRectsIds": [ [1], [16], [17] ],
"alpha": 1,
"chance": 1,
"breakOnMatch": true,
"pattern": [0,0,0,-1,1,0,0,0,0],
"flipX": true,
"flipY": false,
"xModulo": 1,
"yModulo": 1,
"xOffset": 0,
"yOffset": 0,
"tileXOffset": 0,
"tileYOffset": 0,
"tileRandomXMin": 0,
"tileRandomXMax": 0,
"tileRandomYMin": 0,
"tileRandomYMax": 0,
"checker": "None",
"tileMode": "Single",
"pivotX": 0,
"pivotY": 0,
"outOfBoundsValue": 1,
"invalidated": false,
"perlinActive": false,
"perlinSeed": 3063257,
"perlinScale": 0.2,
"perlinOctaves": 2
},
{
"uid": 60,
"active": true,
"size": 1,
"tileRectsIds": [ [1], [16], [17] ],
"alpha": 1,
"chance": 1,
"breakOnMatch": true,
"pattern": [1],
"flipX": false,
"flipY": false,
"xModulo": 1,
"yModulo": 1,
"xOffset": 0,
"yOffset": 0,
"tileXOffset": 0,
"tileYOffset": 0,
"tileRandomXMin": 0,
"tileRandomXMax": 0,
"tileRandomYMin": 0,
"tileRandomYMax": 0,
"checker": "None",
"tileMode": "Single",
"pivotX": 0,
"pivotY": 0,
"outOfBoundsValue": 1,
"invalidated": false,
"perlinActive": false,
"perlinSeed": 3197348,
"perlinScale": 0.2,
"perlinOctaves": 2
},
{
"uid": 62,
"active": true,
"size": 1,
"tileRectsIds": [ [1], [16], [17] ],
"alpha": 1,
"chance": 1,
"breakOnMatch": true,
"pattern": [1],
"flipX": false,
"flipY": false,
"xModulo": 1,
"yModulo": 1,
"xOffset": 0,
"yOffset": 0,
"tileXOffset": 0,
"tileYOffset": 0,
"tileRandomXMin": 0,
"tileRandomXMax": 0,
"tileRandomYMin": 0,
"tileRandomYMax": 0,
"checker": "None",
"tileMode": "Single",
"pivotX": 0,
"pivotY": 0,
"outOfBoundsValue": 1,
"invalidated": false,
"perlinActive": false,
"perlinSeed": 3197348,
"perlinScale": 0.2,
"perlinOctaves": 2
}
],
"usesWizard": false,
"requiredBiomeValues": [],
"biomeRequirementMode": 0
},
{
"uid": 49,
"name": "Grass",
"color": null,
"icon": null,
"active": true,
"isOptional": false,
"rules": [
{
"uid": 53,
"active": true,
"size": 1,
"tileRectsIds": [],
@ -175,13 +487,13 @@
"tileRandomYMin": 0,
"tileRandomYMax": 0,
"checker": "None",
"tileMode": "Stamp",
"pivotX": 0.5,
"pivotY": 0.5,
"tileMode": "Single",
"pivotX": 0,
"pivotY": 0,
"outOfBoundsValue": null,
"invalidated": false,
"perlinActive": false,
"perlinSeed": 8387945,
"perlinSeed": 6248467,
"perlinScale": 0.2,
"perlinOctaves": 2
}
@ -192,7 +504,42 @@
}
],
"autoSourceLayerDefUid": null,
"tilesetDefUid": 3,
"tilesetDefUid": 7,
"tilePivotX": 0,
"tilePivotY": 0,
"biomeFieldUid": null
},
{
"__type": "Tiles",
"identifier": "Tiles",
"type": "Tiles",
"uid": 48,
"doc": null,
"uiColor": null,
"gridSize": 16,
"guideGridWid": 0,
"guideGridHei": 0,
"displayOpacity": 1,
"inactiveOpacity": 1,
"hideInList": false,
"hideFieldsWhenInactive": false,
"canSelectWhenInactive": true,
"renderInWorldView": true,
"pxOffsetX": 0,
"pxOffsetY": 0,
"parallaxFactorX": 0,
"parallaxFactorY": 0,
"parallaxScaling": true,
"requiredTags": [],
"excludedTags": [],
"autoTilesKilledByOtherLayerUid": null,
"uiFilterTags": [],
"useAsyncRender": false,
"intGridValues": [],
"intGridValuesGroups": [],
"autoRuleGroups": [],
"autoSourceLayerDefUid": null,
"tilesetDefUid": 7,
"tilePivotX": 0,
"tilePivotY": 0,
"biomeFieldUid": null
@ -229,8 +576,8 @@
"maxCount": 1,
"limitScope": "PerWorld",
"limitBehavior": "MoveLastOne",
"pivotX": 0.5,
"pivotY": 0.5,
"pivotX": 0,
"pivotY": 0,
"fieldDefs": []
},
{
@ -619,14 +966,14 @@
"worldDepth": 0,
"pxWid": 624,
"pxHei": 256,
"__bgColor": "#696A79",
"bgColor": null,
"__bgColor": "#000000",
"bgColor": "#000000",
"useAutoIdentifier": true,
"bgRelPath": null,
"bgPos": null,
"bgPivotX": 0.5,
"bgPivotY": 0.5,
"__smartColor": "#ADADB5",
"__smartColor": "#737373",
"__bgPos": null,
"externalRelPath": null,
"fieldInstances": [],
@ -655,22 +1002,6 @@
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": [
{
"__identifier": "Player",
"__grid": [5,8],
"__pivot": [0.5,0.5],
"__tags": [],
"__tile": { "tilesetUid": 3, "x": 0, "y": 0, "w": 32, "h": 32 },
"__smartColor": "#BE4A2F",
"iid": "e125f890-fec0-11ee-aa65-fbc5461ef1a4",
"width": 16,
"height": 16,
"defUid": 6,
"px": [88,136],
"fieldInstances": [],
"__worldX": 88,
"__worldY": 136
},
{
"__identifier": "Camera",
"__grid": [17,3],
@ -684,16 +1015,32 @@
"defUid": 31,
"px": [280,56],
"fieldInstances": [{ "__identifier": "Target", "__type": "EntityRef", "__value": {
"entityIid": "e125f890-fec0-11ee-aa65-fbc5461ef1a4",
"entityIid": "f8d0c9b0-fec0-11ee-8a35-b5b194835c7d",
"layerIid": "98e95fd0-fec0-11ee-aa65-136eff944257",
"levelIid": "e1f15120-fec0-11ee-aa65-375c6820674f",
"worldIid": "e1f12a10-fec0-11ee-aa65-ef87be1b7c9a"
}, "__tile": null, "defUid": 32, "realEditorValues": [{
"id": "V_String",
"params": ["e125f890-fec0-11ee-aa65-fbc5461ef1a4"]
"params": ["f8d0c9b0-fec0-11ee-8a35-b5b194835c7d"]
}] }],
"__worldX": 280,
"__worldY": 56
},
{
"__identifier": "Player",
"__grid": [5,8],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 3, "x": 0, "y": 0, "w": 32, "h": 32 },
"__smartColor": "#BE4A2F",
"iid": "f8d0c9b0-fec0-11ee-8a35-b5b194835c7d",
"width": 16,
"height": 16,
"defUid": 6,
"px": [80,128],
"fieldInstances": [],
"__worldX": 80,
"__worldY": 128
}
]
},
@ -742,8 +1089,8 @@
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": 3,
"__tilesetRelPath": "brackeys_platformer_assets/sprites/knight.png",
"__tilesetDefUid": 7,
"__tilesetRelPath": "brackeys_platformer_assets/sprites/world_tileset.png",
"iid": "8b07d2f0-fec0-11ee-922b-778cea60df47",
"levelId": 0,
"layerDefUid": 25,
@ -757,25 +1104,145 @@
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,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,2,2,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,0,0,0,0,0,0,0,0,0,0,0,3,2,2,
1,1,0,0,1,2,3,1,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,2,2,0,0,2,4,2,2,1,1,1,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,2,2,2,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,1,1,0,0,0,1,1,1,1,0,0,0,0,0,0,0,2,2,3,1,1,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,3,2,2,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,2,2,2,2,0,0,0,0,
0,0,0,2,2,0,0,0,0,0,0,0,1,1,2,3,1,1,1,0,0,0,1,1,1,0,1,1,0,0,0,0,0,2,2,
0,0,0,0,0,0,0,2,2,3,2,0,0,0,0,0,2,2,2,2,2,2,2,0,0,0,2,2,0,0,4,2,0,0,0,
0,0,2,3,0,0,0,0,0,0,0,4,2,2,2,0,0,0,0,0,2,4,2,2,2,2,2,0,0,0,2,2,0,0,2,
2,0,0,0,0,0,2,2,0,0,0,0,0,0,0,2,2,4,2,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,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,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
1,1,2,2,1,1,1,1,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,0,0,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,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,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,1,1,1,1,1,0,0,0,0,0,0,0,1,
1,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,1,1,1,1,0,0,0,0,
0,0,0,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,1,1,0,0,1,1,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,1,1,0,0,1,1,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,1,1,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,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
],
"autoLayerTiles": [],
"autoLayerTiles": [
{ "px": [256,96], "src": [16,0], "f": 0, "t": 1, "d": [60,250], "a": 1 },
{ "px": [272,96], "src": [16,16], "f": 0, "t": 17, "d": [60,251], "a": 1 },
{ "px": [336,128], "src": [16,16], "f": 0, "t": 17, "d": [60,333], "a": 1 },
{ "px": [352,144], "src": [0,16], "f": 0, "t": 16, "d": [60,373], "a": 1 },
{ "px": [80,176], "src": [16,16], "f": 0, "t": 17, "d": [60,434], "a": 1 },
{ "px": [96,176], "src": [16,16], "f": 0, "t": 17, "d": [60,435], "a": 1 },
{ "px": [544,176], "src": [16,0], "f": 0, "t": 1, "d": [60,463], "a": 1 },
{ "px": [64,192], "src": [0,16], "f": 0, "t": 16, "d": [60,472], "a": 1 },
{ "px": [80,192], "src": [0,16], "f": 0, "t": 16, "d": [60,473], "a": 1 },
{ "px": [96,192], "src": [16,0], "f": 0, "t": 1, "d": [60,474], "a": 1 },
{ "px": [112,192], "src": [0,16], "f": 0, "t": 16, "d": [60,475], "a": 1 },
{ "px": [128,192], "src": [0,16], "f": 0, "t": 16, "d": [60,476], "a": 1 },
{ "px": [544,192], "src": [0,16], "f": 0, "t": 16, "d": [60,502], "a": 1 },
{ "px": [560,192], "src": [0,16], "f": 0, "t": 16, "d": [60,503], "a": 1 },
{ "px": [144,80], "src": [16,0], "f": 0, "t": 1, "d": [59,204], "a": 1 },
{ "px": [160,80], "src": [16,0], "f": 1, "t": 1, "d": [59,205], "a": 1 },
{ "px": [80,160], "src": [0,16], "f": 0, "t": 16, "d": [59,395], "a": 1 },
{ "px": [96,160], "src": [16,16], "f": 1, "t": 17, "d": [59,396], "a": 1 },
{ "px": [528,160], "src": [0,16], "f": 0, "t": 16, "d": [59,423], "a": 1 },
{ "px": [544,160], "src": [0,16], "f": 1, "t": 16, "d": [59,424], "a": 1 },
{ "px": [528,176], "src": [0,16], "f": 0, "t": 16, "d": [59,462], "a": 1 },
{ "px": [48,192], "src": [16,16], "f": 0, "t": 17, "d": [59,471], "a": 1 },
{ "px": [144,192], "src": [16,16], "f": 1, "t": 17, "d": [59,477], "a": 1 },
{ "px": [208,192], "src": [0,16], "f": 0, "t": 16, "d": [59,481], "a": 1 },
{ "px": [224,192], "src": [16,16], "f": 1, "t": 17, "d": [59,482], "a": 1 },
{ "px": [272,192], "src": [16,0], "f": 0, "t": 1, "d": [59,485], "a": 1 },
{ "px": [288,192], "src": [16,0], "f": 1, "t": 1, "d": [59,486], "a": 1 },
{ "px": [528,192], "src": [16,16], "f": 0, "t": 17, "d": [59,501], "a": 1 },
{ "px": [576,192], "src": [0,16], "f": 1, "t": 16, "d": [59,504], "a": 1 },
{ "px": [160,96], "src": [16,0], "f": 0, "t": 1, "d": [58,244], "a": 1 },
{ "px": [256,112], "src": [16,16], "f": 0, "t": 17, "d": [58,289], "a": 1 },
{ "px": [272,112], "src": [16,16], "f": 0, "t": 17, "d": [58,290], "a": 1 },
{ "px": [288,112], "src": [16,0], "f": 0, "t": 1, "d": [58,291], "a": 1 },
{ "px": [320,128], "src": [16,16], "f": 0, "t": 17, "d": [58,332], "a": 1 },
{ "px": [368,160], "src": [16,16], "f": 0, "t": 17, "d": [58,413], "a": 1 },
{ "px": [384,160], "src": [16,0], "f": 0, "t": 1, "d": [58,414], "a": 1 },
{ "px": [64,208], "src": [16,0], "f": 0, "t": 1, "d": [58,511], "a": 1 },
{ "px": [80,208], "src": [16,0], "f": 0, "t": 1, "d": [58,512], "a": 1 },
{ "px": [96,208], "src": [16,0], "f": 0, "t": 1, "d": [58,513], "a": 1 },
{ "px": [112,208], "src": [16,0], "f": 0, "t": 1, "d": [58,514], "a": 1 },
{ "px": [128,208], "src": [16,16], "f": 0, "t": 17, "d": [58,515], "a": 1 },
{ "px": [544,208], "src": [16,16], "f": 0, "t": 17, "d": [58,541], "a": 1 },
{ "px": [560,208], "src": [16,16], "f": 0, "t": 17, "d": [58,542], "a": 1 },
{ "px": [176,96], "src": [0,0], "f": 0, "t": 0, "d": [57,245], "a": 1 },
{ "px": [304,112], "src": [0,0], "f": 0, "t": 0, "d": [57,292], "a": 1 },
{ "px": [320,112], "src": [0,0], "f": 0, "t": 0, "d": [57,293], "a": 1 },
{ "px": [368,144], "src": [0,0], "f": 0, "t": 0, "d": [57,374], "a": 1 },
{ "px": [384,144], "src": [0,0], "f": 0, "t": 0, "d": [57,375], "a": 1 },
{ "px": [64,176], "src": [0,0], "f": 0, "t": 0, "d": [57,433], "a": 1 },
{ "px": [112,176], "src": [0,0], "f": 0, "t": 0, "d": [57,436], "a": 1 },
{ "px": [128,176], "src": [0,0], "f": 0, "t": 0, "d": [57,437], "a": 1 },
{ "px": [560,176], "src": [0,0], "f": 0, "t": 0, "d": [57,464], "a": 1 },
{ "px": [144,96], "src": [0,16], "f": 0, "t": 16, "d": [56,243], "a": 1 },
{ "px": [176,112], "src": [0,16], "f": 0, "t": 16, "d": [56,284], "a": 1 },
{ "px": [192,112], "src": [16,0], "f": 1, "t": 1, "d": [56,285], "a": 1 },
{ "px": [240,112], "src": [0,16], "f": 0, "t": 16, "d": [56,288], "a": 1 },
{ "px": [304,128], "src": [16,0], "f": 0, "t": 1, "d": [56,331], "a": 1 },
{ "px": [336,144], "src": [16,0], "f": 0, "t": 1, "d": [56,372], "a": 1 },
{ "px": [352,160], "src": [0,16], "f": 0, "t": 16, "d": [56,412], "a": 1 },
{ "px": [400,160], "src": [16,16], "f": 1, "t": 17, "d": [56,415], "a": 1 },
{ "px": [48,208], "src": [16,0], "f": 0, "t": 1, "d": [56,510], "a": 1 },
{ "px": [144,208], "src": [16,16], "f": 1, "t": 17, "d": [56,516], "a": 1 },
{ "px": [208,208], "src": [16,0], "f": 0, "t": 1, "d": [56,520], "a": 1 },
{ "px": [224,208], "src": [0,16], "f": 1, "t": 16, "d": [56,521], "a": 1 },
{ "px": [272,208], "src": [0,16], "f": 0, "t": 16, "d": [56,524], "a": 1 },
{ "px": [288,208], "src": [0,16], "f": 1, "t": 16, "d": [56,525], "a": 1 },
{ "px": [528,208], "src": [16,0], "f": 0, "t": 1, "d": [56,540], "a": 1 },
{ "px": [576,208], "src": [16,0], "f": 1, "t": 1, "d": [56,543], "a": 1 },
{ "px": [144,64], "src": [0,0], "f": 0, "t": 0, "d": [55,165], "a": 1 },
{ "px": [160,64], "src": [0,0], "f": 1, "t": 0, "d": [55,166], "a": 1 },
{ "px": [256,80], "src": [0,0], "f": 0, "t": 0, "d": [55,211], "a": 1 },
{ "px": [272,80], "src": [0,0], "f": 1, "t": 0, "d": [55,212], "a": 1 },
{ "px": [192,96], "src": [0,0], "f": 1, "t": 0, "d": [55,246], "a": 1 },
{ "px": [240,96], "src": [0,0], "f": 0, "t": 0, "d": [55,249], "a": 1 },
{ "px": [288,96], "src": [0,0], "f": 1, "t": 0, "d": [55,252], "a": 1 },
{ "px": [336,112], "src": [0,0], "f": 1, "t": 0, "d": [55,294], "a": 1 },
{ "px": [352,128], "src": [0,0], "f": 1, "t": 0, "d": [55,334], "a": 1 },
{ "px": [80,144], "src": [0,0], "f": 0, "t": 0, "d": [55,356], "a": 1 },
{ "px": [96,144], "src": [0,0], "f": 1, "t": 0, "d": [55,357], "a": 1 },
{ "px": [400,144], "src": [0,0], "f": 1, "t": 0, "d": [55,376], "a": 1 },
{ "px": [528,144], "src": [0,0], "f": 0, "t": 0, "d": [55,384], "a": 1 },
{ "px": [544,144], "src": [0,0], "f": 1, "t": 0, "d": [55,385], "a": 1 },
{ "px": [48,176], "src": [0,0], "f": 0, "t": 0, "d": [55,432], "a": 1 },
{ "px": [144,176], "src": [0,0], "f": 1, "t": 0, "d": [55,438], "a": 1 },
{ "px": [208,176], "src": [0,0], "f": 0, "t": 0, "d": [55,442], "a": 1 },
{ "px": [224,176], "src": [0,0], "f": 1, "t": 0, "d": [55,443], "a": 1 },
{ "px": [272,176], "src": [0,0], "f": 0, "t": 0, "d": [55,446], "a": 1 },
{ "px": [288,176], "src": [0,0], "f": 1, "t": 0, "d": [55,447], "a": 1 },
{ "px": [576,176], "src": [0,0], "f": 1, "t": 0, "d": [55,465], "a": 1 },
{ "px": [176,176], "src": [160,0], "f": 0, "t": 10, "d": [70,440], "a": 1 },
{ "px": [208,96], "src": [144,0], "f": 0, "t": 9, "d": [69,247], "a": 1 },
{ "px": [224,96], "src": [144,0], "f": 1, "t": 9, "d": [69,248], "a": 1 },
{ "px": [160,176], "src": [144,0], "f": 0, "t": 9, "d": [69,439], "a": 1 },
{ "px": [192,176], "src": [144,0], "f": 1, "t": 9, "d": [69,441], "a": 1 }
],
"seed": 1402800,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "Tiles",
"__type": "Tiles",
"__cWid": 39,
"__cHei": 16,
"__gridSize": 16,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": 7,
"__tilesetRelPath": "brackeys_platformer_assets/sprites/world_tileset.png",
"iid": "1b81fbe0-fec0-11ee-8a35-abb9c4438572",
"levelId": 0,
"layerDefUid": 48,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 5707028,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
}
],
"__neighbours": []

View file

@ -1,4 +1,4 @@
use bevy::{input::InputPlugin, prelude::*};
use bevy::prelude::*;
use bevy_ecs_ldtk::prelude::*;
use bevy_xpbd_2d::prelude::*;

View file

@ -46,10 +46,3 @@ impl Plugin for GamePlugin {
}
}
fn spawn_camera(mut commands: Commands) {
let mut camera = Camera2dBundle::default();
camera.projection.scale = 0.5;
camera.transform.translation.x += 1280.0 / 4.0;
camera.transform.translation.y += 720.0 / 4.0;
commands.spawn(camera);
}

View file

@ -1,82 +1,38 @@
use bevy::prelude::*;
use bevy_xpbd_2d::{
math::{Scalar, Vector, PI},
math::{Scalar, Vector},
prelude::*,
SubstepSchedule, SubstepSet,
};
use crate::GRAVITY_VECTOR;
use super::movement::*;
#[derive(Component, Reflect)]
#[component(storage = "SparseSet")]
pub struct Grounded;
#[derive(Component, Reflect)]
pub struct JumpImpulse(Scalar);
impl Default for JumpImpulse {
fn default() -> Self {
JumpImpulse(7.)
}
}
#[derive(Component, Reflect)]
pub struct MaxJumpDuration(Scalar);
impl Default for MaxJumpDuration {
fn default() -> Self {
MaxJumpDuration(0.1)
}
}
#[derive(Component, Reflect)]
pub struct MovementAcceleration(Scalar);
impl Default for MovementAcceleration {
fn default() -> Self {
MovementAcceleration(75.)
}
}
#[derive(Component, Reflect)]
pub struct MovementDampingFactor(Scalar);
impl Default for MovementDampingFactor {
fn default() -> Self {
MovementDampingFactor(0.9)
}
}
#[derive(Component, Reflect)]
pub struct MaxSlopeAngle(Scalar);
impl Default for MaxSlopeAngle {
fn default() -> Self {
MaxSlopeAngle(PI * 0.45)
}
}
#[derive(Component, Default, Reflect)]
pub struct CharacterController;
#[derive(Component, Reflect)]
#[derive(Component, Deref, Reflect)]
pub struct ControllerGravity(Vector);
impl std::ops::Mul<Scalar> for ControllerGravity {
type Output = Self;
fn mul(self, rhs: Scalar) -> Self::Output {
Self(*self * rhs)
}
}
impl Default for ControllerGravity {
fn default() -> Self {
ControllerGravity(GRAVITY_VECTOR)
}
}
#[derive(Bundle, Default)]
pub struct MovementBundle {
acceleration: MovementAcceleration,
damping: MovementDampingFactor,
jump_impulse: JumpImpulse,
max_slope_angle: MaxSlopeAngle,
direction: MovementDirection,
}
#[derive(Bundle)]
pub struct CharacterControllerBundle {
character_controller: CharacterController,
@ -93,6 +49,7 @@ impl Default for CharacterControllerBundle {
let collider = Collider::rectangle(12., 24.);
let mut caster_shape = collider.clone();
caster_shape.set_scale(Vector::ONE * 0.5, 1);
let multiple = 17.;
Self {
locked_axes: LockedAxes::ROTATION_LOCKED,
@ -101,10 +58,10 @@ impl Default for CharacterControllerBundle {
collider,
ground_caster: ShapeCaster::new(caster_shape, Vector::ZERO, 0.0, Direction2d::NEG_Y)
.with_max_time_of_impact(1.0),
gravity: ControllerGravity(GRAVITY_VECTOR * 5.),
gravity: ControllerGravity::default_multiple(multiple),
movement: MovementBundle {
acceleration: MovementAcceleration(420.),
jump_impulse: JumpImpulse(46.),
acceleration: MovementAcceleration::default_multiple(multiple),
jump_impulse: JumpImpulse::default_multiple(multiple),
..default()
},
}
@ -115,9 +72,6 @@ impl Default for CharacterControllerBundle {
#[component(storage = "SparseSet")]
pub struct Jumping;
#[derive(Component, Default, Reflect)]
pub struct MovementDirection(pub Scalar);
pub struct CharacterControllerPlugin;
impl Plugin for CharacterControllerPlugin {
fn build(&self, app: &mut App) {

View file

@ -1,15 +1,16 @@
mod controller;
mod input;
mod movement;
use bevy::prelude::*;
use bevy_ecs_ldtk::prelude::*;
use leafwing_input_manager::{action_state::ActionState, input_map::InputMap, InputManagerBundle};
use leafwing_input_manager::{action_state::ActionState, InputManagerBundle};
use self::{
controller::{
CharacterControllerBundle, CharacterControllerPlugin, Jumping, MovementDirection,
CharacterControllerBundle, CharacterControllerPlugin, Jumping,
},
input::{InputPlugin, PlayerAction},
input::{InputPlugin, PlayerAction}, movement::MovementDirection,
};
#[derive(Component, Default)]

124
src/player/movement.rs Normal file
View file

@ -0,0 +1,124 @@
use std::ops::Mul;
use bevy::prelude::*;
use bevy_xpbd_2d::math::{Scalar, PI};
pub trait DefaultMultiple {
fn default_multiple(n: Scalar) -> Self;
}
impl<T: Default + Mul<Scalar, Output = T>> DefaultMultiple for T {
fn default_multiple(n: Scalar) -> Self {
Self::default() * n
}
}
#[derive(Component, Reflect, Deref)]
pub struct JumpImpulse(pub Scalar);
impl Default for JumpImpulse {
fn default() -> Self {
JumpImpulse(7.)
}
}
impl Mul<Scalar> for JumpImpulse {
type Output = Self;
fn mul(self, rhs: Scalar) -> Self::Output {
Self(self.0 * rhs)
}
}
#[derive(Component, Reflect, Deref)]
pub struct MaxJumpDuration(pub Scalar);
impl Default for MaxJumpDuration {
fn default() -> Self {
MaxJumpDuration(0.1)
}
}
impl Mul<Scalar> for MaxJumpDuration {
type Output = Self;
fn mul(self, rhs: Scalar) -> Self::Output {
Self(self.0 * rhs)
}
}
#[derive(Component, Deref, Reflect)]
pub struct MovementAcceleration(pub Scalar);
impl Mul<Scalar> for MovementAcceleration {
type Output = Self;
fn mul(self, rhs: Scalar) -> Self::Output {
Self(self.0 * rhs)
}
}
impl Default for MovementAcceleration {
fn default() -> Self {
MovementAcceleration(75.)
}
}
#[derive(Component, Deref, Reflect)]
pub struct MovementDampingFactor(pub Scalar);
impl Mul<Scalar> for MovementDampingFactor {
type Output = Self;
fn mul(self, rhs: Scalar) -> Self::Output {
Self(self.0 * rhs)
}
}
impl Default for MovementDampingFactor {
fn default() -> Self {
MovementDampingFactor(0.9)
}
}
#[derive(Component, Deref, Reflect)]
pub struct MaxSlopeAngle(pub Scalar);
impl Mul<Scalar> for MaxSlopeAngle {
type Output = Self;
fn mul(self, rhs: Scalar) -> Self::Output {
Self(self.0 * rhs)
}
}
impl Default for MaxSlopeAngle {
fn default() -> Self {
MaxSlopeAngle(PI * 0.45)
}
}
#[derive(Component, Default, Reflect)]
pub struct MovementDirection(pub Scalar);
#[derive(Bundle, Default)]
pub struct MovementBundle {
pub acceleration: MovementAcceleration,
pub damping: MovementDampingFactor,
pub jump_impulse: JumpImpulse,
pub max_slope_angle: MaxSlopeAngle,
pub direction: MovementDirection,
}
impl DefaultMultiple for MovementBundle {
fn default_multiple(n: Scalar) -> Self {
Self {
acceleration: MovementAcceleration::default_multiple(n),
damping: MovementDampingFactor::default_multiple(n),
jump_impulse: JumpImpulse::default_multiple(n),
max_slope_angle: MaxSlopeAngle::default_multiple(n),
direction: MovementDirection::default(),
}
}
}