From 9198ca096b393dd513c792e728c4ec1f076b1b39 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 28 Jul 2020 10:04:44 -0400 Subject: [PATCH] Boxes don't need animation --- src/components.rs | 4 ++++ src/entities.rs | 7 ++----- src/map.rs | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components.rs b/src/components.rs index e48a6dc..510b076 100644 --- a/src/components.rs +++ b/src/components.rs @@ -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(()) diff --git a/src/entities.rs b/src/entities.rs index 550a917..b728c36 100644 --- a/src/entities.rs +++ b/src/entities.rs @@ -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 = 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(); diff --git a/src/map.rs b/src/map.rs index 9e4b7ab..37a50e5 100644 --- a/src/map.rs +++ b/src/map.rs @@ -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);