add player::handle_input
This commit is contained in:
parent
b223dcdb29
commit
c98a6d7dc5
|
@ -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),
|
||||
))
|
||||
|
|
|
@ -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<ButtonInput<KeyCode>>,
|
||||
) {
|
||||
if keyboard_input.pressed(KeyCode::KeyW) {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue