Skip to content

Commit

Permalink
Fixed camera2D.rs example (raylib-rs#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
o-dka authored May 7, 2024
1 parent 3fafcfc commit 82a8ceb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions samples/camera2D.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,16 @@ fn main() {

let mut camera = Camera2D {
target: Vector2::new(player.x + 20.0, player.y + 20.0),
// offset: Vector2::new(player.x, player.y),
offset: Vector2::new(0.0, 0.0),
offset: Vector2::new(player.x, player.y),
rotation: 0.0,
zoom: 1.0,
};

while !rl.window_should_close() {
if rl.is_key_down(KEY_RIGHT) {
player.x += 2.0;
camera.offset.x -= 2.0;
player.x += 2.0;
} else if rl.is_key_down(KEY_LEFT) {
player.x -= 2.0;
camera.offset.x += 2.0;
}

// Camera follows player
Expand Down

0 comments on commit 82a8ceb

Please sign in to comment.