MIGUEL IDLE ANIMATIONN

This commit is contained in:
2024-11-09 22:55:50 +02:00
parent 65606557f2
commit 46d3f94426
3 changed files with 102 additions and 8 deletions

View File

@@ -11,7 +11,7 @@
"iid": "ee0ceef0-73f0-11ef-b8f3-3f3814adfda6", "iid": "ee0ceef0-73f0-11ef-b8f3-3f3814adfda6",
"jsonVersion": "1.5.3", "jsonVersion": "1.5.3",
"appBuildId": 473703, "appBuildId": 473703,
"nextUid": 58, "nextUid": 60,
"identifierStyle": "Capitalize", "identifierStyle": "Capitalize",
"toc": [], "toc": [],
"worldLayout": "LinearHorizontal", "worldLayout": "LinearHorizontal",
@@ -760,7 +760,82 @@
"limitBehavior": "MoveLastOne", "limitBehavior": "MoveLastOne",
"pivotX": 0.5, "pivotX": 0.5,
"pivotY": 1, "pivotY": 1,
"fieldDefs": [] "fieldDefs": [
{
"identifier": "animation_timer",
"doc": null,
"__type": "Float",
"uid": 58,
"type": "F_Float",
"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_Float", "params": [0.3] },
"textLanguageMode": null,
"symmetricalRef": false,
"autoChainRef": true,
"allowOutOfLevelRef": true,
"allowedRefs": "OnlySame",
"allowedRefsEntityUid": null,
"allowedRefTags": [],
"tilesetUid": null
},
{
"identifier": "animation_indices",
"doc": null,
"__type": "Array<Int>",
"uid": 59,
"type": "F_Int",
"isArray": true,
"canBeNull": false,
"arrayMinLength": 2,
"arrayMaxLength": 2,
"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_Int", "params": [0] },
"textLanguageMode": null,
"symmetricalRef": false,
"autoChainRef": true,
"allowOutOfLevelRef": true,
"allowedRefs": "OnlySame",
"allowedRefsEntityUid": null,
"allowedRefTags": [],
"tilesetUid": null
}
]
}, },
{ {
"identifier": "Goal", "identifier": "Goal",
@@ -1251,7 +1326,10 @@
"height": 16, "height": 16,
"defUid": 14, "defUid": 14,
"px": [40,144], "px": [40,144],
"fieldInstances": [] "fieldInstances": [
{ "__identifier": "animation_timer", "__type": "Float", "__value": 0.3, "__tile": null, "defUid": 58, "realEditorValues": [] },
{ "__identifier": "animation_indices", "__type": "Array<Int>", "__value": [0,3], "__tile": null, "defUid": 59, "realEditorValues": [ { "id": "V_Int", "params": [0] }, { "id": "V_Int", "params": [3] } ] }
]
}, },
{ {
"__identifier": "Goal", "__identifier": "Goal",
@@ -2044,7 +2122,10 @@
"height": 16, "height": 16,
"defUid": 14, "defUid": 14,
"px": [24,160], "px": [24,160],
"fieldInstances": [] "fieldInstances": [
{ "__identifier": "animation_timer", "__type": "Float", "__value": 0.3, "__tile": null, "defUid": 58, "realEditorValues": [] },
{ "__identifier": "animation_indices", "__type": "Array<Int>", "__value": [0,3], "__tile": null, "defUid": 59, "realEditorValues": [ { "id": "V_Int", "params": [0] }, { "id": "V_Int", "params": [3] } ] }
]
}, },
{ {
"__identifier": "Goal", "__identifier": "Goal",
@@ -2916,7 +2997,10 @@
"height": 16, "height": 16,
"defUid": 14, "defUid": 14,
"px": [64,176], "px": [64,176],
"fieldInstances": [] "fieldInstances": [
{ "__identifier": "animation_timer", "__type": "Float", "__value": 0.3, "__tile": null, "defUid": 58, "realEditorValues": [] },
{ "__identifier": "animation_indices", "__type": "Array<Int>", "__value": [0,3], "__tile": null, "defUid": 59, "realEditorValues": [ null, { "id": "V_Int", "params": [3] } ] }
]
}, },
{ {
"__identifier": "Goal", "__identifier": "Goal",

View File

@@ -1,3 +1,4 @@
use animations::ShockingAnimationPlugin;
use bevy::prelude::*; use bevy::prelude::*;
use bevy_ecs_ldtk::prelude::*; use bevy_ecs_ldtk::prelude::*;
use bevy_rapier2d::plugin::{NoUserData, RapierConfiguration, RapierPhysicsPlugin, TimestepMode}; use bevy_rapier2d::plugin::{NoUserData, RapierConfiguration, RapierPhysicsPlugin, TimestepMode};
@@ -8,6 +9,7 @@ use level_structure::{WallBundle, WallPlugin};
use logging::log_positions; use logging::log_positions;
use player::PlayerPlugin; use player::PlayerPlugin;
mod animations;
mod camera; mod camera;
mod colliders; mod colliders;
mod goal; mod goal;
@@ -45,8 +47,9 @@ fn main() {
.register_ldtk_int_cell::<WallBundle>(1) .register_ldtk_int_cell::<WallBundle>(1)
.add_systems(Startup, setup) .add_systems(Startup, setup)
.add_plugins(CameraPlugin) .add_plugins(CameraPlugin)
.add_plugins(ShockingAnimationPlugin)
.add_systems(Update, (translate_grid_coords_entities, check_goal)) .add_systems(Update, (translate_grid_coords_entities, check_goal))
.add_systems(Update, log_positions) // .add_systems(Update, log_positions)
.run(); .run();
} }

View File

@@ -2,7 +2,11 @@ use bevy::prelude::*;
use bevy_ecs_ldtk::prelude::*; use bevy_ecs_ldtk::prelude::*;
use bevy_rapier2d::dynamics::Velocity; use bevy_rapier2d::dynamics::Velocity;
use crate::{colliders::ColliderBundle, ground_detection::GroundDetection}; use crate::{
animations::{AnimationIndices, AnimationTimer},
colliders::ColliderBundle,
ground_detection::GroundDetection,
};
pub struct PlayerPlugin; pub struct PlayerPlugin;
@@ -35,6 +39,10 @@ struct PlayerBundle {
pub ground_detection: GroundDetection, pub ground_detection: GroundDetection,
#[from_entity_instance] #[from_entity_instance]
pub collider_bundle: ColliderBundle, pub collider_bundle: ColliderBundle,
#[from_entity_instance]
animation_timer: AnimationTimer,
#[from_entity_instance]
animation_indices: AnimationIndices,
} }
fn player_movement( fn player_movement(
@@ -72,5 +80,4 @@ fn player_movement(
velocity.linvel.y = 500.; velocity.linvel.y = 500.;
} }
} }
} }