mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
Fix the left/right movement direction in state example. (#1879)
Direction of movement was reversed, previously.
(i.e. Left arrow key moved sprite to the right; Right arrow key moved sprite to the left.)
This PR changes the code to now be consistent with, for example, the breakout example: 81b53d15d4/examples/game/breakout.rs (L184-L190)
i.e. AFAICT it's not an issue with the keycode being different/wrong.
This commit is contained in:
parent
294feeedc0
commit
57e3d4f1c2
1 changed files with 2 additions and 2 deletions
|
@ -119,10 +119,10 @@ fn movement(
|
||||||
for mut transform in query.iter_mut() {
|
for mut transform in query.iter_mut() {
|
||||||
let mut direction = Vec3::ZERO;
|
let mut direction = Vec3::ZERO;
|
||||||
if input.pressed(KeyCode::Left) {
|
if input.pressed(KeyCode::Left) {
|
||||||
direction.x += 1.0;
|
direction.x -= 1.0;
|
||||||
}
|
}
|
||||||
if input.pressed(KeyCode::Right) {
|
if input.pressed(KeyCode::Right) {
|
||||||
direction.x -= 1.0;
|
direction.x += 1.0;
|
||||||
}
|
}
|
||||||
if input.pressed(KeyCode::Up) {
|
if input.pressed(KeyCode::Up) {
|
||||||
direction.y += 1.0;
|
direction.y += 1.0;
|
||||||
|
|
Loading…
Reference in a new issue