From 8be2749edf97b200281a2c67f97ed8835f5c6d88 Mon Sep 17 00:00:00 2001 From: troido Date: Fri, 7 Feb 2020 19:54:35 +0100 Subject: spawn is also loaded from room template --- src/room.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/room.rs') diff --git a/src/room.rs b/src/room.rs index 8d15bde..dc7c849 100644 --- a/src/room.rs +++ b/src/room.rs @@ -18,7 +18,8 @@ use super::resources::{ Size, Output, Input, - NewEntities + NewEntities, + Spawn }; use super::systems::{ moving::Move, @@ -69,14 +70,16 @@ impl <'a, 'b>Room<'a, 'b> { self.world.fetch_mut::().width = width; self.world.fetch_mut::().height = height; - // todo: set spawn + self.world.fetch_mut::().pos = template.spawn; for (idx, templates) in template.field.iter().enumerate() { let x = (idx as i64) % width; let y = (idx as i64) / width; for template in templates { - self.add_entity(template, Pos{x, y}); + if let Err(msg) = self.add_entity(template, Pos{x, y}){ + println!("{}", msg); + } } } } -- cgit