Skip to content

Commit

Permalink
Update to use new API
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel McNab committed Sep 7, 2021
1 parent 7f1338e commit 8c46ade
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 41 deletions.
72 changes: 39 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bevy-intro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ license = "MIT OR Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = { git = "https://github.com/bevyengine/bevy", rev = "c5717b5a9124c7c2f7431c4be07f15243ebd60b5" }
bevy = { git = "https://github.com/bevyengine/bevy", rev = "e3170586776b165f40e446780fc4f9a4ed04187d" }
2 changes: 1 addition & 1 deletion dino-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ license = "MIT OR Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = { git = "https://github.com/bevyengine/bevy", rev = "c5717b5a9124c7c2f7431c4be07f15243ebd60b5" }
bevy = { git = "https://github.com/bevyengine/bevy", rev = "e3170586776b165f40e446780fc4f9a4ed04187d" }
8 changes: 2 additions & 6 deletions dino-runner/src/movement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ fn jump(
) {
let (mut dino_velocity, mut grounded) = dino.single_mut().unwrap();
if matches!(*grounded, GroundState::OnGround)
&& (keyboard.pressed(KeyCode::Space)
|| keyboard.pressed(KeyCode::Up)
|| keyboard.pressed(KeyCode::W))
&& keyboard.any_pressed([KeyCode::Space, KeyCode::Up, KeyCode::W])
{
*grounded = GroundState::InAir;
dino_velocity.0 = 300.;
Expand All @@ -77,9 +75,7 @@ fn snap(
keyboard: Res<Input<KeyCode>>,
) {
let (mut velocity, grounded) = dino.single_mut().unwrap();
if matches!(grounded, GroundState::InAir)
&& (keyboard.pressed(KeyCode::Down) || keyboard.pressed(KeyCode::S))
{
if matches!(grounded, GroundState::InAir) && keyboard.any_pressed([KeyCode::Down, KeyCode::S]) {
velocity.0 -= 600.;
}
}
Expand Down

0 comments on commit 8c46ade

Please sign in to comment.