Skip to content

Commit

Permalink
psychiatrist wip
Browse files Browse the repository at this point in the history
  • Loading branch information
stillonearth committed Jun 5, 2024
1 parent 623b5e9 commit 4289afc
Show file tree
Hide file tree
Showing 10 changed files with 180 additions and 17 deletions.
130 changes: 128 additions & 2 deletions assets/levels/example.ldtk
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"iid": "a3386460-7820-11ed-b6fd-157a63b4d02d",
"jsonVersion": "1.5.3",
"appBuildId": 473703,
"nextUid": 229,
"appBuildId": 475928,
"nextUid": 232,
"identifierStyle": "Capitalize",
"toc": [
{
Expand Down Expand Up @@ -73,6 +73,21 @@
"layerIid": "d53f9951-c640-11ed-8430-3f3f71a3daf1",
"entityIid": "8ee89370-8990-11ee-b898-d15885d355ef"
}, "worldX": 543, "worldY": 273, "widPx": 8, "heiPx": 8, "fields" : {} }]
},
{
"identifier": "Psychiatrist",
"instances": [{
"worldIid": "c9ef2d10-c640-11ed-ad34-f553e1d803f9",
"levelIid": "d53f9950-c640-11ed-8430-4942c04951ff",
"layerIid": "d53f9951-c640-11ed-8430-3f3f71a3daf1",
"entityIid": "9c94c930-fec0-11ee-91ea-c39aba4200e5"
}],
"instancesData": [{ "iids": {
"worldIid": "c9ef2d10-c640-11ed-ad34-f553e1d803f9",
"levelIid": "d53f9950-c640-11ed-8430-4942c04951ff",
"layerIid": "d53f9951-c640-11ed-8430-3f3f71a3daf1",
"entityIid": "9c94c930-fec0-11ee-91ea-c39aba4200e5"
}, "worldX": 376, "worldY": 232, "widPx": 16, "heiPx": 16, "fields" : {} }]
}
],
"worldLayout": null,
Expand Down Expand Up @@ -1228,6 +1243,82 @@
"pivotX": 0.5,
"pivotY": 0.5,
"fieldDefs": []
},
{
"identifier": "Psychiatrist",
"uid": 229,
"tags": ["actor"],
"exportToToc": true,
"allowOutOfBounds": false,
"doc": null,
"width": 16,
"height": 16,
"resizableX": false,
"resizableY": false,
"minWidth": null,
"maxWidth": null,
"minHeight": null,
"maxHeight": null,
"keepAspectRatio": false,
"tileOpacity": 1,
"fillOpacity": 0.08,
"lineOpacity": 0,
"hollow": false,
"color": "#03CB7C",
"renderMode": "Tile",
"showName": true,
"tilesetId": 104,
"tileRenderMode": "Stretch",
"tileRect": { "tilesetUid": 104, "x": 80, "y": 240, "w": 16, "h": 16 },
"uiTileRect": null,
"nineSliceBorders": [],
"maxCount": 0,
"limitScope": "PerLevel",
"limitBehavior": "MoveLastOne",
"pivotX": 0.5,
"pivotY": 0.5,
"fieldDefs": [
{
"identifier": "is_dummy",
"doc": null,
"__type": "Bool",
"uid": 230,
"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,
"exportToToc": false,
"searchable": 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": [
{
Expand Down Expand Up @@ -1487,6 +1578,25 @@
"customData": [],
"savedSelections": [],
"cachedPixelData": { "opaqueTiles": "0", "averageColors": "6655" }
},
{
"__cWid": 1,
"__cHei": 3,
"identifier": "Psychiatrist",
"uid": 231,
"relPath": "../sprites/psychiatrist.png",
"embedAtlas": null,
"pxWid": 15,
"pxHei": 32,
"tileGridSize": 15,
"spacing": 0,
"padding": 0,
"tags": [],
"tagsSourceEnumUid": null,
"enumTags": [],
"customData": [],
"savedSelections": [],
"cachedPixelData": { "opaqueTiles": "001", "averageColors": "c854bccc0000" }
}
], "enums": [{ "identifier": "Item", "uid": 66, "values": [], "iconTilesetUid": 104, "externalRelPath": null, "externalFileChecksum": null, "tags": [] }], "externalEnums": [], "levelFields": [
{
Expand Down Expand Up @@ -1861,6 +1971,22 @@
"fieldInstances": [],
"__worldX": 472,
"__worldY": 120
},
{
"__identifier": "Psychiatrist",
"__grid": [7,14],
"__pivot": [0.5,0.5],
"__tags": ["actor"],
"__tile": { "tilesetUid": 104, "x": 80, "y": 240, "w": 16, "h": 16 },
"__smartColor": "#03CB7C",
"iid": "9c94c930-fec0-11ee-91ea-c39aba4200e5",
"width": 16,
"height": 16,
"defUid": 229,
"px": [120,232],
"fieldInstances": [{ "__identifier": "is_dummy", "__type": "Bool", "__value": true, "__tile": null, "defUid": 230, "realEditorValues": [] }],
"__worldX": 376,
"__worldY": 232
}
]
},
Expand Down
Binary file modified assets/sprites/psychiatrist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 17 additions & 2 deletions src/entities/characters/enemy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub enum EnemyType {
#[default]
Mierda,
Pendejo,
Psychiatrist,
}

#[derive(Clone, PartialEq, Debug, Default, Component, Reflect)]
Expand Down Expand Up @@ -89,7 +90,7 @@ pub fn create_enemy_bundle(
5,
1,
None,
16.,
Vec2::ONE * 16.,
texture_atlasses,
),
AnimatedCharacterType::NotAnimated,
Expand All @@ -106,12 +107,24 @@ pub fn create_enemy_bundle(
SHEET_1_COLUMNS,
SHEET_1_ROWS,
None,
64.,
Vec2::ONE * 64.,
texture_atlasses,
),
*spritesheet_type,
)
}
EnemyType::Psychiatrist => (
load_texture_atlas(
PSYCHIATRIST_ASSET_SHEET.to_string(),
asset_server,
1,
1,
None,
Vec2::new(32., 16.),
texture_atlasses,
),
AnimatedCharacterType::NotAnimated,
),
};

let sprite_bundle = SpriteSheetBundle {
Expand Down Expand Up @@ -298,6 +311,7 @@ pub fn handle_enemy_hit(
let damage = match enemy.enemy_type {
EnemyType::Mierda => (1.0 * event.damage as f32) as u8,
EnemyType::Pendejo => (0.5 * event.damage as f32) as u8,
EnemyType::Psychiatrist => (1.0 * event.damage as f32) as u8,
};

let timer = Timer::new(std::time::Duration::from_millis(200), TimerMode::Once);
Expand Down Expand Up @@ -338,6 +352,7 @@ pub fn despawn_dead_enemies(
enemy.marked_for_despawn = true;
score.score += match enemy.enemy_type {
EnemyType::Mierda => 100,
EnemyType::Psychiatrist => 5000,
EnemyType::Pendejo => 50,
};

Expand Down
2 changes: 2 additions & 0 deletions src/entities/characters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use bevy::prelude::*;
pub mod enemy;
pub mod mierda;
pub mod pendejo;
pub mod psychiatrist;

pub struct CharactersPlugin;

Expand All @@ -18,6 +19,7 @@ impl Plugin for CharactersPlugin {
enemy::EnemyPlugin,
mierda::MierdaPlugin,
pendejo::PendejoPlugin,
psychiatrist::PsychiatristPlugin,
));
}
}
4 changes: 2 additions & 2 deletions src/entities/items/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn create_item_bundle(
1,
1,
None,
16.,
Vec2::ONE * 16.,
texture_atlasses,
),
ItemType::Biboran => load_texture_atlas(
Expand All @@ -79,7 +79,7 @@ pub fn create_item_bundle(
1,
1,
None,
32.,
Vec2::ONE * 32.,
texture_atlasses,
),
};
Expand Down
2 changes: 1 addition & 1 deletion src/entities/level_objects/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn create_lantern_bundle(
1,
1,
None,
32.,
Vec2::ONE * 32.,
texture_atlasses,
);

Expand Down
2 changes: 1 addition & 1 deletion src/entities/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl LdtkEntity for PlayerBundle {
SHEET_1_COLUMNS,
SHEET_1_ROWS,
None,
64.,
Vec2::ONE * 64.,
texture_atlasses,
);

Expand Down
9 changes: 8 additions & 1 deletion src/gameplay/waves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub enum WaveEntry {
Pizza { count: usize },
Pendejo { count: usize },
Biboran { count: usize },
Boss { count: usize },
}

#[derive(Clone)]
Expand Down Expand Up @@ -198,6 +199,12 @@ pub fn event_wave(
item_type: ItemType::Biboran,
});
}
WaveEntry::Boss { count } => {
ev_enemy_spawn.send(SpawnEnemyEvent {
count: count as u32,
enemy_type: EnemyType::Psychiatrist,
});
}
}

gameplay_state.wave_event_timer = Timer::new(
Expand Down Expand Up @@ -230,7 +237,7 @@ pub fn ui_wave_info_text(
pub fn get_level_1_waves() -> Vec<Wave> {
vec![
Wave {
events: vec![WaveEntry::Pizza { count: 0 }],
events: vec![WaveEntry::Boss { count: 1 }],
event_duration: Duration::from_secs(100),
wave_duration: Duration::from_secs(100),
},
Expand Down
Loading

0 comments on commit 4289afc

Please sign in to comment.