diff --git a/examples/dodge-the-creeps/rust/src/player.rs b/examples/dodge-the-creeps/rust/src/player.rs index 1dade77f7..c933ed41e 100644 --- a/examples/dodge-the-creeps/rust/src/player.rs +++ b/examples/dodge-the-creeps/rust/src/player.rs @@ -67,16 +67,16 @@ impl GodotExt for Player { // Note: exact=false by default, in Rust we have to provide it explicitly let input = Input::singleton(); if input.is_action_pressed("ui_right".into(), false) { - velocity.x += 1.0; + velocity += Vector2::RIGHT; } if input.is_action_pressed("ui_left".into(), false) { - velocity.x -= 1.0; + velocity += Vector2::LEFT; } if input.is_action_pressed("ui_down".into(), false) { - velocity.y += 1.0; + velocity += Vector2::DOWN; } if input.is_action_pressed("ui_up".into(), false) { - velocity.y -= 1.0; + velocity += Vector2::UP; } if velocity.length() > 0.0 {