diff --git a/src/main.rs b/src/main.rs index a0080e0..3d6a9b4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,7 @@ fn main() { )) .add_systems(Update, ( handle_input, + player::handle_input, audio::toggle_bgm, world::asset_loaded.after(world::load_cubemap_asset), )) diff --git a/src/player.rs b/src/player.rs index 8b4b212..e0e6ba9 100644 --- a/src/player.rs +++ b/src/player.rs @@ -4,8 +4,26 @@ use bevy::prelude::*; pub struct Player { pub hp: f32, pub pos: Vec3, + pub v: Vec3, +} + +impl Default for Player { + fn default() -> Self { + Self { + hp: 100.0, + pos: Vec3::ZERO, + v: Vec3::ZERO, + } + } } pub fn setup(mut commands: Commands) { - commands.spawn(Player{ hp: 100.0, pos: Vec3::ZERO}); + commands.spawn(Player::default()); +} + +pub fn handle_input( + keyboard_input: Res>, +) { + if keyboard_input.pressed(KeyCode::KeyW) { + } }