Slightly better signature for keyboard handler
This commit is contained in:
@@ -107,14 +107,13 @@ fn apply_velocity(mut query: Query<(&mut Transform, &Velocity)>, time: Res<Time>
|
|||||||
fn check_keyboard(
|
fn check_keyboard(
|
||||||
keyboard_input: Res<ButtonInput<KeyCode>>,
|
keyboard_input: Res<ButtonInput<KeyCode>>,
|
||||||
mut app_exit_events: ResMut<Events<bevy::app::AppExit>>,
|
mut app_exit_events: ResMut<Events<bevy::app::AppExit>>,
|
||||||
mut query: Query<(&mut Velocity, &Transform), With<PlayerBoid>>,
|
mut query: Query<&mut Velocity, With<PlayerBoid>>,
|
||||||
time: Res<Time>,
|
|
||||||
) {
|
) {
|
||||||
if keyboard_input.just_pressed(KeyCode::KeyQ) {
|
if keyboard_input.just_pressed(KeyCode::KeyQ) {
|
||||||
app_exit_events.send(bevy::app::AppExit::Success);
|
app_exit_events.send(bevy::app::AppExit::Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
let (mut pvelocity, ptransform) = query.single_mut();
|
let mut pvelocity = query.single_mut();
|
||||||
let mut dir = Vec2::ZERO;
|
let mut dir = Vec2::ZERO;
|
||||||
if keyboard_input.pressed(KeyCode::ArrowLeft) {
|
if keyboard_input.pressed(KeyCode::ArrowLeft) {
|
||||||
dir.x -= 1.0;
|
dir.x -= 1.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user