diff --git a/Cargo.toml b/Cargo.toml index 2820259..32e6675 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,8 @@ edition = "2021" license = "MIT OR Apache-2.0" [dependencies] -bevy = "0.11.3" -bevy_ecs_ldtk = "0.8" +bevy = "0.11" +bevy_ecs_ldtk = {version="0.8", features=["default", "derive", "atlas", "render"]} bevy-inspector-egui = "0.19" bevy_rapier2d = "0.22" rand = "0.8.5" diff --git a/assets/levels/example.ldtk b/assets/levels/example.ldtk index 6cdcd5f..35e9800 100644 --- a/assets/levels/example.ldtk +++ b/assets/levels/example.ldtk @@ -5,13 +5,13 @@ "doc": "https://ldtk.io/json", "schema": "https://ldtk.io/files/JSON_SCHEMA.json", "appAuthor": "Sebastien 'deepnight' Benard", - "appVersion": "1.4.0", + "appVersion": "1.4.1", "url": "https://ldtk.io" }, "iid": "a3386460-7820-11ed-b6fd-157a63b4d02d", - "jsonVersion": "1.4.0", - "appBuildId": 470969, - "nextUid": 194, + "jsonVersion": "1.4.1", + "appBuildId": 471199, + "nextUid": 195, "identifierStyle": "Capitalize", "toc": [{ "identifier": "Player", @@ -907,7 +907,46 @@ "limitBehavior": "MoveLastOne", "pivotX": 0.5, "pivotY": 0.5, - "fieldDefs": [] + "fieldDefs": [ + { + "identifier": "is_dummy", + "doc": "Indicates whether this entity is used as a blueprint to spawn new enemies of the level on", + "__type": "Bool", + "uid": 194, + "type": "F_Bool", + "isArray": false, + "canBeNull": false, + "arrayMinLength": null, + "arrayMaxLength": null, + "editorDisplayMode": "Hidden", + "editorDisplayScale": 1, + "editorDisplayPos": "Above", + "editorLinkStyle": "StraightArrow", + "editorDisplayColor": null, + "editorAlwaysShow": false, + "editorShowInWorld": true, + "editorCutLongValues": true, + "editorTextSuffix": null, + "editorTextPrefix": null, + "useForSmartColor": false, + "min": null, + "max": null, + "regex": null, + "acceptFileTypes": null, + "defaultOverride": { + "id": "V_Bool", + "params": [ true ] + }, + "textLanguageMode": null, + "symmetricalRef": false, + "autoChainRef": true, + "allowOutOfLevelRef": true, + "allowedRefs": "OnlySame", + "allowedRefsEntityUid": null, + "allowedRefTags": [], + "tilesetUid": null + } + ] } ], "tilesets": [ { @@ -1097,611 +1136,19 @@ }, { "__identifier": "Mierda", - "__grid": [6,7], + "__grid": [20,7], "__pivot": [0.5,0.5], "__tags": ["actor"], "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, "__smartColor": "#EAD4AA", - "__worldX": 360, + "__worldX": 584, "__worldY": 120, - "iid": "66ab01d0-3b70-11ee-bcd6-c783cc84d9ce", - "width": 8, - "height": 8, - "defUid": 192, - "px": [104,120], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [21,3], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 600, - "__worldY": 56, - "iid": "672f7410-3b70-11ee-bcd6-2f9537a8d84c", - "width": 8, - "height": 8, - "defUid": 192, - "px": [344,56], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [22,10], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 616, - "__worldY": 168, - "iid": "67e90010-3b70-11ee-bcd6-65c42a9c337e", - "width": 8, - "height": 8, - "defUid": 192, - "px": [360,168], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [8,12], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 392, - "__worldY": 200, - "iid": "688e40c0-3b70-11ee-bcd6-f7ee7a3fb1e6", - "width": 8, - "height": 8, - "defUid": 192, - "px": [136,200], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [13,5], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 472, - "__worldY": 88, "iid": "88df7860-3b70-11ee-af32-434acdf6fd95", "width": 8, "height": 8, "defUid": 192, - "px": [216,88], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [22,7], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 616, - "__worldY": 120, - "iid": "8930a5a0-3b70-11ee-af32-297e7ef405e5", - "width": 8, - "height": 8, - "defUid": 192, - "px": [360,120], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [19,11], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 568, - "__worldY": 184, - "iid": "896b64b0-3b70-11ee-af32-fd5c452cda2b", - "width": 8, - "height": 8, - "defUid": 192, - "px": [312,184], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [13,11], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 472, - "__worldY": 184, - "iid": "899dbf50-3b70-11ee-af32-3310642d3111", - "width": 8, - "height": 8, - "defUid": 192, - "px": [216,184], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [11,8], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 440, - "__worldY": 136, - "iid": "89d32730-3b70-11ee-af32-3d081de82a17", - "width": 8, - "height": 8, - "defUid": 192, - "px": [184,136], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [9,5], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 408, - "__worldY": 88, - "iid": "8a0b2720-3b70-11ee-af32-33564b0928b9", - "width": 8, - "height": 8, - "defUid": 192, - "px": [152,88], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [7,9], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 376, - "__worldY": 152, - "iid": "8a4aa120-3b70-11ee-af32-ddf200f2d9ce", - "width": 8, - "height": 8, - "defUid": 192, - "px": [120,152], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [5,11], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 344, - "__worldY": 184, - "iid": "8a82c820-3b70-11ee-af32-1bac9f94a97a", - "width": 8, - "height": 8, - "defUid": 192, - "px": [88,184], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [3,7], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 312, - "__worldY": 120, - "iid": "8aba79f0-3b70-11ee-af32-2126a6628039", - "width": 8, - "height": 8, - "defUid": 192, - "px": [56,120], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [4,5], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 328, - "__worldY": 88, - "iid": "8aed70d0-3b70-11ee-af32-bb105641802d", - "width": 8, - "height": 8, - "defUid": 192, - "px": [72,88], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [4,3], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 328, - "__worldY": 56, - "iid": "8b399500-3b70-11ee-af32-6d4b03216d39", - "width": 8, - "height": 8, - "defUid": 192, - "px": [72,56], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [25,4], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 664, - "__worldY": 72, - "iid": "8b904080-3b70-11ee-af32-dbcb1dfe3a59", - "width": 8, - "height": 8, - "defUid": 192, - "px": [408,72], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [27,11], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 696, - "__worldY": 184, - "iid": "8bc81960-3b70-11ee-af32-05ba5d08d2bc", - "width": 8, - "height": 8, - "defUid": 192, - "px": [440,184], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [21,12], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 600, - "__worldY": 200, - "iid": "8c1c2cd0-3b70-11ee-af32-79e255946237", - "width": 8, - "height": 8, - "defUid": 192, - "px": [344,200], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [18,6], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 552, - "__worldY": 104, - "iid": "8c542cc0-3b70-11ee-af32-7f72113b08a7", - "width": 8, - "height": 8, - "defUid": 192, - "px": [296,104], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [16,3], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 520, - "__worldY": 56, - "iid": "8c9db8e0-3b70-11ee-af32-17031bc6ee54", - "width": 8, - "height": 8, - "defUid": 192, - "px": [264,56], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [15,6], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 504, - "__worldY": 104, - "iid": "8ce4fb10-3b70-11ee-af32-57e063d8f672", - "width": 8, - "height": 8, - "defUid": 192, - "px": [248,104], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [28,8], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 712, - "__worldY": 136, - "iid": "8d367670-3b70-11ee-af32-7dc8ba6f61c5", - "width": 8, - "height": 8, - "defUid": 192, - "px": [456,136], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [15,12], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 504, - "__worldY": 200, - "iid": "8d9eae20-3b70-11ee-af32-3dcb1fe5e216", - "width": 8, - "height": 8, - "defUid": 192, - "px": [248,200], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [13,9], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 472, - "__worldY": 152, - "iid": "8e67a370-3b70-11ee-af32-434f8ca8a2bd", - "width": 8, - "height": 8, - "defUid": 192, - "px": [216,152], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [10,10], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 424, - "__worldY": 168, - "iid": "8eb415c0-3b70-11ee-af32-d14f0ec5d469", - "width": 8, - "height": 8, - "defUid": 192, - "px": [168,168], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [8,7], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 392, - "__worldY": 120, - "iid": "8ef38fc0-3b70-11ee-af32-79427a7d35fb", - "width": 8, - "height": 8, - "defUid": 192, - "px": [136,120], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [11,3], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 440, - "__worldY": 56, - "iid": "8f3d6a00-3b70-11ee-af32-779abed2a663", - "width": 8, - "height": 8, - "defUid": 192, - "px": [184,56], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [7,3], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 376, - "__worldY": 56, - "iid": "8f7f5500-3b70-11ee-af32-57eff7fd9e5d", - "width": 8, - "height": 8, - "defUid": 192, - "px": [120,56], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [4,10], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 328, - "__worldY": 168, - "iid": "8fc69730-3b70-11ee-af32-2552cabb65d8", - "width": 8, - "height": 8, - "defUid": 192, - "px": [72,168], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [21,9], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 600, - "__worldY": 152, - "iid": "90369710-3b70-11ee-af32-3bb42bdbc940", - "width": 8, - "height": 8, - "defUid": 192, - "px": [344,152], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [18,9], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 552, - "__worldY": 152, - "iid": "9082bb40-3b70-11ee-af32-ada343ae749b", - "width": 8, - "height": 8, - "defUid": 192, - "px": [296,152], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [17,12], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 536, - "__worldY": 200, - "iid": "90d436a0-3b70-11ee-af32-85efc26fee5a", - "width": 8, - "height": 8, - "defUid": 192, - "px": [280,200], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [25,12], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 664, - "__worldY": 200, - "iid": "91113fa0-3b70-11ee-af32-eb3f699088fb", - "width": 8, - "height": 8, - "defUid": 192, - "px": [408,200], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [25,7], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 664, - "__worldY": 120, - "iid": "914017d0-3b70-11ee-af32-79bf9e0f3c75", - "width": 8, - "height": 8, - "defUid": 192, - "px": [408,120], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [22,5], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 616, - "__worldY": 88, - "iid": "91813f80-3b70-11ee-af32-b9002fe7ef02", - "width": 8, - "height": 8, - "defUid": 192, - "px": [360,88], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [19,7], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 568, - "__worldY": 120, - "iid": "91af0640-3b70-11ee-af32-216cf9799d8d", - "width": 8, - "height": 8, - "defUid": 192, - "px": [312,120], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [28,4], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 712, - "__worldY": 72, - "iid": "91f0ca30-3b70-11ee-af32-4b60263472b0", - "width": 8, - "height": 8, - "defUid": 192, - "px": [456,72], - "fieldInstances": [] - }, - { - "__identifier": "Mierda", - "__grid": [20,4], - "__pivot": [0.5,0.5], - "__tags": ["actor"], - "__tile": { "tilesetUid": 193, "x": 64, "y": 0, "w": 16, "h": 16 }, - "__smartColor": "#EAD4AA", - "__worldX": 584, - "__worldY": 72, - "iid": "9249e6b0-3b70-11ee-af32-ddb8d8ad9c0e", - "width": 8, - "height": 8, - "defUid": 192, - "px": [328,72], - "fieldInstances": [] + "px": [328,120], + "fieldInstances": [{ "__identifier": "is_dummy", "__type": "Bool", "__value": true, "__tile": null, "defUid": 194, "realEditorValues": [] }] } ] }, diff --git a/src/components.rs b/src/components.rs index da191a9..d7a0842 100644 --- a/src/components.rs +++ b/src/components.rs @@ -1,4 +1,3 @@ -use rand; use std::time::Duration; use bevy::prelude::*; @@ -38,16 +37,17 @@ impl From<&EntityInstance> for ColliderBundle { } } -#[derive(Copy, Clone, Eq, PartialEq, Debug, Default, Component)] +#[derive(Copy, Clone, Eq, PartialEq, Debug, Default, Component, Reflect)] pub struct Player { pub health: u8, } -#[derive(Clone, PartialEq, Debug, Default, Component)] +#[derive(Clone, PartialEq, Debug, Default, Component, Reflect)] pub struct Mierda { pub move_direction: Vec2, pub health: u8, pub hit_at: Option, + pub is_dummy: bool, } #[derive(Clone, Default, Bundle)] @@ -60,7 +60,7 @@ pub struct PlayerBundle { pub active_events: ActiveEvents, } -#[derive(Component, Clone, Default)] +#[derive(Component, Clone, Default, Reflect)] pub struct DirectionUpdateTime { /// track when the bomb should explode (non-repeating timer) pub timer: Timer, @@ -77,6 +77,7 @@ pub struct MierdaBundle { pub fn create_mierda_bundle( asset_server: &AssetServer, texture_atlasses: &mut Assets, + is_dummy: bool, ) -> MierdaBundle { let rotation_constraints = LockedAxes::ROTATION_LOCKED; @@ -115,6 +116,7 @@ pub fn create_mierda_bundle( } .normalize(), hit_at: None, + is_dummy, }; MierdaBundle { @@ -184,3 +186,22 @@ impl FromWorld for PlayerSpritesheets { } } } + +pub(crate) fn fix_missing_mierda_compontents( + asset_server: Res, + texture_atlasses: ResMut>, + mut commands: Commands, + los_mierdas: Query<(Entity, &Mierda), Without>, +) { + let asset_server = asset_server.into_inner(); + let texture_atlasses = texture_atlasses.into_inner(); + + for (e, _) in los_mierdas.iter().filter(|(_, m)| !m.is_dummy) { + let bundle = create_mierda_bundle(asset_server, texture_atlasses, false); + commands.entity(e).insert(( + bundle.collider_bundle, + bundle.direction_update_time, + Visibility::Visible, + )); + } +} diff --git a/src/main.rs b/src/main.rs index 56070ee..3ff7a1d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,7 @@ use bevy::prelude::*; use bevy_ecs_ldtk::prelude::*; use bevy_inspector_egui::quick::WorldInspectorPlugin; use bevy_rapier2d::prelude::*; +use components::Mierda; use pecs::prelude::*; mod ai; @@ -14,10 +15,18 @@ mod ldtk; mod physics; mod sprites; mod ui; +mod utils; fn main() { - App::new() - .add_plugins(DefaultPlugins) + let mut app = App::new(); + + { + let registry = app.world.resource_mut::(); + let mut wr = registry.write(); + wr.register::(); + } + + app.add_plugins(DefaultPlugins) .add_plugins(PecsPlugin) .add_plugins(WorldInspectorPlugin::new()) .add_systems(Startup, setup) @@ -50,6 +59,14 @@ fn main() { Update, (ai::mierda_activity, ai::update_mierdas_move_direction), ) + // Housekeeping + .add_systems( + Update, + ( + ldtk::hide_dummy_mierdas, + components::fix_missing_mierda_compontents, + ), + ) // Sprites .init_resource::() .add_systems(Update, (sprites::animate_sprite, sprites::flash_sprite)) @@ -85,8 +102,10 @@ fn main() { .add_event::() .add_event::() .add_event::() - .add_event::() - .run(); + .add_event::(); + + app.run(); + // .run(); } fn setup(mut commands: Commands, asset_server: Res) {