Boxes don't need animation
This commit is contained in:
parent
73a0b08cfd
commit
9198ca096b
@ -6,6 +6,8 @@ use std::fmt::Display;
|
||||
pub enum BoxColor {
|
||||
Red,
|
||||
Blue,
|
||||
Green,
|
||||
Brown,
|
||||
}
|
||||
|
||||
impl Display for BoxColor {
|
||||
@ -13,6 +15,8 @@ impl Display for BoxColor {
|
||||
fmt.write_str(match self {
|
||||
BoxColor::Red => "red",
|
||||
BoxColor::Blue => "blue",
|
||||
BoxColor::Green => "green",
|
||||
BoxColor::Brown => "brown",
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
|
@ -45,11 +45,8 @@ pub fn create_floor(world: &mut World, position: Position) {
|
||||
}
|
||||
|
||||
pub fn create_box(world: &mut World, position: Position, color: BoxColor) {
|
||||
let mut sprites: Vec<String> = vec![];
|
||||
for x in 1..=2 {
|
||||
sprites.push(format!("/images/box_{}_{}.png", color, x));
|
||||
}
|
||||
animated_entity(world, position, 10, sprites)
|
||||
let path = format!("/images/box_{}.png", color);
|
||||
static_entity(world, position, 10, &path)
|
||||
.with(Box { color })
|
||||
.with(Movable)
|
||||
.build();
|
||||
|
@ -26,7 +26,7 @@ pub fn load_map(world: &mut World, map_string: String) {
|
||||
}
|
||||
"*" => {
|
||||
create_floor(world, position);
|
||||
create_box(world, position, BoxColor::Blue);
|
||||
create_box(world, position, BoxColor::Brown);
|
||||
}
|
||||
"+" => {
|
||||
create_floor(world, position);
|
||||
@ -34,7 +34,7 @@ pub fn load_map(world: &mut World, map_string: String) {
|
||||
}
|
||||
"%" => {
|
||||
create_floor(world, position);
|
||||
create_box_spot(world, position, BoxColor::Blue);
|
||||
create_box_spot(world, position, BoxColor::Brown);
|
||||
}
|
||||
"=" => {
|
||||
create_floor(world, position);
|
||||
|
Loading…
Reference in New Issue
Block a user