From 6bf9e96140c91340d6ae643b6e0896aa734d8605 Mon Sep 17 00:00:00 2001 From: tom barrett Date: Tue, 2 Jul 2019 04:23:33 -0500 Subject: entities now spawn on points --- src/tileset.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/tileset.rs') diff --git a/src/tileset.rs b/src/tileset.rs index df7045d..0595186 100644 --- a/src/tileset.rs +++ b/src/tileset.rs @@ -74,6 +74,15 @@ impl Tileset { *self.tiles.get(&id).unwrap() } + pub fn get_spawn_tiles(&self) -> Vec<(String, usize)> { + self.properties + .clone() + .into_iter() + .filter(|p| p.spawn.is_some()) + .map(|p| (p.spawn.unwrap(), p.tile_id)) + .collect() + } + pub fn get_animation(&self, tile_id: usize) -> Vec<(usize, Rect)> { if let Some(property) = self.properties.iter().find(|p| p.tile_id == tile_id) { self.properties -- cgit v1.2.3