diff --git a/assets/maps/map1.map b/assets/maps/map1.map index 4c912c1..056edbb 100644 --- a/assets/maps/map1.map +++ b/assets/maps/map1.map @@ -844,3 +844,19 @@ ( 768 1008 -224 ) ( 768 1008 -223 ) ( 768 1009 -224 ) crate [ 0 1 0 16 ] [ 0 0 -1 0 ] 90 1 1 } } +// entity 3 +{ +"classname" "enemy_spawn" +"origin" "648 -680 -248" +"angles" "0 -75 0" +} +// entity 4 +{ +"classname" "cash_spawn" +"origin" "696 1192 8" +} +// entity 5 +{ +"classname" "enemy_spawn" +"origin" "3256 248 -248" +} diff --git a/assets/models/cash.glb b/assets/models/cash.glb new file mode 100644 index 0000000..a0c99c4 Binary files /dev/null and b/assets/models/cash.glb differ diff --git a/src/alien.rs b/src/alien.rs index 4e73b34..17a47e6 100644 --- a/src/alien.rs +++ b/src/alien.rs @@ -1,8 +1,7 @@ -use avian3d::prelude::*; use bevy::prelude::*; use std::time::Duration; -const ASSET_PATH: &str = "models/alien_naked.glb"; +pub const ALIEN_ASSET_PATH: &str = "models/alien_naked.glb"; #[derive(Resource)] struct Animations { @@ -22,8 +21,8 @@ fn setup( ) { // Build the animation graph let (graph, node_indices) = AnimationGraph::from_clips([ - asset_server.load(GltfAssetLabel::Animation(1).from_asset(ASSET_PATH)), - asset_server.load(GltfAssetLabel::Animation(0).from_asset(ASSET_PATH)), + asset_server.load(GltfAssetLabel::Animation(1).from_asset(ALIEN_ASSET_PATH)), + asset_server.load(GltfAssetLabel::Animation(0).from_asset(ALIEN_ASSET_PATH)), ]); // Insert a resource with the current scene information @@ -32,18 +31,6 @@ fn setup( animations: node_indices, graph: graph_handle, }); - - commands - .spawn(( - RigidBody::Dynamic, - Collider::capsule(0.2, 1.), - LockedAxes::new().lock_rotation_z().lock_rotation_x(), - Name::from("Alien"), - )) - .with_child(( - Transform::from_translation(Vec3::new(0., -0.6, 0.)), - SceneRoot(asset_server.load(GltfAssetLabel::Scene(0).from_asset(ASSET_PATH))), - )); } fn setup_once_loaded( diff --git a/src/cash.rs b/src/cash.rs new file mode 100644 index 0000000..eec0475 --- /dev/null +++ b/src/cash.rs @@ -0,0 +1,16 @@ +use bevy::prelude::*; + +#[derive(Component, Reflect, Default)] +#[reflect(Component)] +#[require(Transform)] +pub struct Cash; + +pub fn plugin(app: &mut App) { + app.add_systems(Update, rotate); +} + +fn rotate(time: Res