We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c1a36da commit 6370183Copy full SHA for 6370183
examples/dodge-the-creeps/rust/src/player.rs
@@ -67,16 +67,16 @@ impl GodotExt for Player {
67
// Note: exact=false by default, in Rust we have to provide it explicitly
68
let input = Input::singleton();
69
if input.is_action_pressed("ui_right".into(), false) {
70
- velocity.x += 1.0;
+ velocity += Vector2::RIGHT;
71
}
72
if input.is_action_pressed("ui_left".into(), false) {
73
- velocity.x -= 1.0;
+ velocity += Vector2::LEFT;
74
75
if input.is_action_pressed("ui_down".into(), false) {
76
- velocity.y += 1.0;
+ velocity += Vector2::DOWN;
77
78
if input.is_action_pressed("ui_up".into(), false) {
79
- velocity.y -= 1.0;
+ velocity += Vector2::UP;
80
81
82
if velocity.length() > 0.0 {
0 commit comments