Skip to content

Commit 3182bd4

Browse files
bors[bot]RealAstolfo
and
RealAstolfo
authored
Merge #69
69: PR #5/5 Astolfo feature/example-update r=Bromeon a=RealAstolfo Changed the example to fit the newer rust api Co-Authored-By: Thomas ten Cate <[email protected]> Co-authored-by: RealAstolfo <[email protected]>
2 parents 895283f + 6370183 commit 3182bd4

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)