Skip to content

Commit

Permalink
Merge #69
Browse files Browse the repository at this point in the history
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 <ttencate@gmail.com>

Co-authored-by: RealAstolfo <astolfo.gman@gmail.com>
  • Loading branch information
bors[bot] and RealAstolfo authored Feb 1, 2023
2 parents 895283f + 6370183 commit 3182bd4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/dodge-the-creeps/rust/src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3182bd4

Please sign in to comment.