Skip to content

Commit e2c2368

Browse files
committed
fix infintie shot bug
1 parent f33ae70 commit e2c2368

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "manzana-attack"
3-
version = "1.0.0"
3+
version = "1.1.0"
44
authors = ["lislis <mail@lislis.de>"]
55

66
[[bin]]

src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,11 @@ impl Player {
143143
let y = self.y as f64;
144144
let x = self.calc_coord(x);
145145
let y = self.calc_coord(y);
146-
self.shots.fire();
147-
self.apples.push(Apple::new(x, y));
146+
println!("{}", self.shots.left);
147+
if self.shots.left > 0 {
148+
self.shots.fire();
149+
self.apples.push(Apple::new(x, y));
150+
}
148151
}
149152
pub fn update(&mut self) {
150153
for a in self.apples.iter_mut() {

0 commit comments

Comments
 (0)