fn move_player(keyboard_input: Res<Input<KeyCode>>, mut query: Query<&mut Position, With<Player>>) {
    for mut pos in query.iter_mut() {
        const SPEED: i32 = 1;

        let mut direction = IVec3::new(0, 0, 0);

        if keyboard_input.pressed(KeyCode::Left) {
            direction += IVec3::new(-SPEED, 0, 0);
        }

        if keyboard_input.pressed(KeyCode::Right) {
            direction += IVec3::new(SPEED, 0, 0);
        }

        if keyboard_input.pressed(KeyCode::Up) {
            direction += IVec3::new(0, -SPEED, 0);
        }

        if keyboard_input.pressed(KeyCode::Down) {
            direction += IVec3::new(0, SPEED, 0);
        }

        if direction != IVec3::new(0, 0, 0) {
            **pos += direction;
        }
    }
}
// TODO: figure out how to tie this to a dynamic function (in wasm?)
figure out how to tie this to a dynamic function (in wasm?)
figure out how to tie this to a dynamic function ( in wasm? )
fn move_player(keyboard_input: Res<Input<KeyCode>>, mut query: Query<&mut Position, With<Player>>) {
    for mut pos in query.iter_mut() {
        const SPEED: i32 = 1;
        let mut direction = IVec3::new(0, 0, 0);
        if keyboard_input.pressed(KeyCode::Left) {
            direction += IVec3::new(-SPEED, 0, 0);
        }
        if keyboard_input.pressed(KeyCode::Right) {
            direction += IVec3::new(SPEED, 0, 0);
        }
        if keyboard_input.pressed(KeyCode::Up) {
            direction += IVec3::new(0, -SPEED, 0);
        }
        if keyboard_input.pressed(KeyCode::Down) {
            direction += IVec3::new(0, SPEED, 0);
        }
        if direction != IVec3::new(0, 0, 0) {
            **pos += direction;
        }
    }
}
fn move_player ( keyboard_input : Res < Input < KeyCode > > , mut query : Query < & mut Position , With < Player > > ) { for mut pos in query . iter_mut ( ) { const SPEED : i32 = 1 ; let mut direction = IVec3 :: new ( 0 , 0 , 0 ) ; if keyboard_input . pressed ( KeyCode :: Left ) { direction += IVec3 :: new ( - SPEED , 0 , 0 ) ; } if keyboard_input . pressed ( KeyCode :: Right ) { direction += IVec3 :: new ( SPEED , 0 , 0 ) ; } if keyboard_input . pressed ( KeyCode :: Up ) { direction += IVec3 :: new ( 0 , - SPEED , 0 ) ; } if keyboard_input . pressed ( KeyCode :: Down ) { direction += IVec3 :: new ( 0 , SPEED , 0 ) ; } if direction != IVec3 :: new ( 0 , 0 , 0 ) { * * pos += direction ; } } }
TODO: figure out how to tie this to a dynamic function (in wasm?)
TODO : figure out how to tie this to a dynamic function ( in wasm? )
keyboard_input
Res<Input<KeyCode>>
query
Query<&mut Position, With<Player>>
keyboard_input
Res<Input<KeyCode>>
query
Query<&mut Position, With<Player>>