Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Fix player moving right
Browse files Browse the repository at this point in the history
  • Loading branch information
logancammish authored Apr 28, 2024
1 parent 576326a commit 189b539
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/ai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ impl Player {
mesh.draw(&mut frame.as_target());
}


pub fn move_right(&mut self, width: f32) {
let head = self.position.last().unwrap().clone();
if head.0 != width {
self.position.push(Position(head.0 + 7.5, head.1));
let enemy = self.position.last().unwrap().clone();
if enemy.0 <= width {
self.position.push(Position(enemy.0 + 7.5, enemy.1));
} else {
self.position.push(Position(0.0, head.1));
self.position.push(Position(0.0, enemy.1));
}
}

Expand Down

0 comments on commit 189b539

Please sign in to comment.