From 637018399f96109028f53b4eb66147b3a20d2800 Mon Sep 17 00:00:00 2001 From: RealAstolfo Date: Mon, 16 Jan 2023 21:22:01 +0100 Subject: [PATCH] Update player.rs --- examples/dodge-the-creeps/rust/src/player.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 {