This commit is contained in:
Jay Oster 2021-12-04 10:00:58 -08:00 committed by GitHub
parent bd2de37b84
commit b15854b4d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 17 deletions

View file

@ -1,5 +1,5 @@
/// Player control inputs.
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct Controls {
/// Move the player.
pub direction: Direction,
@ -18,15 +18,6 @@ pub enum Direction {
Right,
}
impl Default for Controls {
fn default() -> Controls {
Controls {
direction: Direction::default(),
fire: false,
}
}
}
impl Default for Direction {
fn default() -> Direction {
Direction::Still

View file

@ -49,7 +49,7 @@ pub struct World {
player: Player,
bullet: Option<Bullet>,
collision: Collision,
score: u32,
_score: u32,
assets: Assets,
dt: Duration,
gameover: bool,
@ -72,7 +72,7 @@ struct Invaders {
struct Invader {
sprite: SpriteRef,
pos: Point,
score: u32,
_score: u32,
}
/// Creates a boundary around the live invaders.
@ -172,7 +172,7 @@ impl World {
};
let bullet = None;
let collision = Collision::default();
let score = 0;
let _score = 0;
let dt = Duration::default();
let gameover = false;
@ -185,7 +185,7 @@ impl World {
player,
bullet,
collision,
score,
_score,
assets,
dt,
gameover,
@ -556,7 +556,7 @@ fn make_invader_grid(assets: &Assets) -> Vec<Vec<Option<Invader>>> {
Some(Invader {
sprite: SpriteRef::new(assets, Blipjoy1, Duration::default()),
pos: START + BLIPJOY_OFFSET + Point::new(x, y) * GRID,
score: 10,
_score: 10,
})
})
.collect()
@ -567,7 +567,7 @@ fn make_invader_grid(assets: &Assets) -> Vec<Vec<Option<Invader>>> {
Some(Invader {
sprite: SpriteRef::new(assets, Ferris1, Duration::default()),
pos: START + FERRIS_OFFSET + Point::new(x, y) * GRID,
score: 10,
_score: 10,
})
})
.collect()
@ -578,7 +578,7 @@ fn make_invader_grid(assets: &Assets) -> Vec<Vec<Option<Invader>>> {
Some(Invader {
sprite: SpriteRef::new(assets, Cthulhu1, Duration::default()),
pos: START + CTHULHU_OFFSET + Point::new(x, y) * GRID,
score: 10,
_score: 10,
})
})
.collect()