Struct mission2teegarden_b_map::Map
source · pub struct Map {
pub name: String,
pub width: u8,
pub height: u8,
pub base_layer: Vec<Vec<(MapBaseTile, Orientation)>>,
pub object_layer: Vec<Vec<Option<(ObjectTile, Orientation)>>>,
pub global_goal: Option<(u8, u8)>,
pub player_1: Player,
pub player_2: Option<Player>,
pub player_3: Option<Player>,
pub player_4: Option<Player>,
pub cards: AvailableCards,
pub story: Story,
}
Fields§
§name: String
§width: u8
§height: u8
§base_layer: Vec<Vec<(MapBaseTile, Orientation)>>
§object_layer: Vec<Vec<Option<(ObjectTile, Orientation)>>>
§global_goal: Option<(u8, u8)>
§player_1: Player
§player_2: Option<Player>
§player_3: Option<Player>
§player_4: Option<Player>
§cards: AvailableCards
§story: Story
Implementations§
source§impl Map
impl Map
sourcepub fn passable(&self, x: u8, y: u8) -> bool
pub fn passable(&self, x: u8, y: u8) -> bool
return if all static tiles at x,y postion are passable
sourcepub fn from_string(str: &str) -> Result<Self, SpannedError>
pub fn from_string(str: &str) -> Result<Self, SpannedError>
Load map from String. Allowing to load map from binary format
pub fn from_tmx(path: impl AsRef<Path>) -> Result<Self, MapError>
sourcepub fn load_from_file<P>(path: P) -> Result<Self>where
P: AsRef<Path>,
pub fn load_from_file<P>(path: P) -> Result<Self>where P: AsRef<Path>,
load a map from file. Can be at tiled map or a Misson to Teegarden b map.
pub fn iter_player(&self) -> impl Iterator<Item = &Player>
pub fn iter_mut_player(&mut self) -> impl Iterator<Item = &mut Player>
sourcepub fn iter_base_layer(
&self
) -> impl Iterator<Item = (u8, u8, MapBaseTile, Orientation)> + '_
pub fn iter_base_layer( &self ) -> impl Iterator<Item = (u8, u8, MapBaseTile, Orientation)> + '_
return an iterator over all BasteTiles and its x and y postion
sourcepub fn iter_object_layer(
&self
) -> impl Iterator<Item = (u8, u8, ObjectTile, Orientation)> + '_
pub fn iter_object_layer( &self ) -> impl Iterator<Item = (u8, u8, ObjectTile, Orientation)> + '_
return an iterator over all ObjectTiles and its x and y postion
sourcepub fn iter_player_goals(
&self
) -> impl Iterator<Item = (u8, u8, PlayerTile)> + '_
pub fn iter_player_goals( &self ) -> impl Iterator<Item = (u8, u8, PlayerTile)> + '_
return an iterator over all player goals tiles and its x and y postion
Trait Implementations§
source§impl<'de> Deserialize<'de> for Map
impl<'de> Deserialize<'de> for Map
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl RefUnwindSafe for Map
impl Send for Map
impl Sync for Map
impl Unpin for Map
impl UnwindSafe for Map
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more