summaryrefslogtreecommitdiff
path: root/src/tileset.rs
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2019-07-02 04:23:33 -0500
committertom barrett <spalf0@gmail.com>2019-07-02 04:23:33 -0500
commit6bf9e96140c91340d6ae643b6e0896aa734d8605 (patch)
treeea5fba741326bd952b7808d402c4bbaf572d170d /src/tileset.rs
parent1b5f06e902b9e5c5b0d5897fc981eeaa6dc39b37 (diff)
entities now spawn on points
Diffstat (limited to 'src/tileset.rs')
-rw-r--r--src/tileset.rs9
1 files changed, 9 insertions, 0 deletions
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