Fix: apply steering input properly
The ship in Asteroids isn't expected to spin up while holding a steering direction, but that's exactly what I just made it do. Fix that problem by assigning, not accumulating, the angular velocity for the ship.
This commit is contained in:
@@ -280,9 +280,11 @@ fn input_ship_rotation(
|
||||
};
|
||||
|
||||
if keyboard_input.pressed(KeyCode::KeyA) {
|
||||
angular_vel.0 += SHIP_ROTATION;
|
||||
angular_vel.0 = SHIP_ROTATION;
|
||||
} else if keyboard_input.pressed(KeyCode::KeyD) {
|
||||
angular_vel.0 -= SHIP_ROTATION;
|
||||
angular_vel.0 = -SHIP_ROTATION;
|
||||
} else {
|
||||
angular_vel.0 = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user