Skip to content

Commit 6370183

Browse files
RealAstolfoBromeon
RealAstolfo
authored andcommitted
Update player.rs
1 parent c1a36da commit 6370183

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/dodge-the-creeps/rust/src/player.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ impl GodotExt for Player {
6767
// Note: exact=false by default, in Rust we have to provide it explicitly
6868
let input = Input::singleton();
6969
if input.is_action_pressed("ui_right".into(), false) {
70-
velocity.x += 1.0;
70+
velocity += Vector2::RIGHT;
7171
}
7272
if input.is_action_pressed("ui_left".into(), false) {
73-
velocity.x -= 1.0;
73+
velocity += Vector2::LEFT;
7474
}
7575
if input.is_action_pressed("ui_down".into(), false) {
76-
velocity.y += 1.0;
76+
velocity += Vector2::DOWN;
7777
}
7878
if input.is_action_pressed("ui_up".into(), false) {
79-
velocity.y -= 1.0;
79+
velocity += Vector2::UP;
8080
}
8181

8282
if velocity.length() > 0.0 {

0 commit comments

Comments
 (0)