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

source

pub fn passable(&self, x: u8, y: u8) -> bool

return if all static tiles at x,y postion are passable

source

pub fn from_string(str: &str) -> Result<Self, SpannedError>

Load map from String. Allowing to load map from binary format

source

pub fn to_string(&self) -> String

Convert map to String, to be used as binary file format

source

pub fn from_tmx(path: impl AsRef<Path>) -> Result<Self, MapError>

source

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.

source

pub fn iter_player(&self) -> impl Iterator<Item = &Player>

source

pub fn iter_mut_player(&mut self) -> impl Iterator<Item = &mut Player>

source

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

source

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

source

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

source

pub fn iter_all(&self) -> impl Iterator<Item = (u8, u8, Tile, Orientation)> + '_

return an iterator over all static Tiles and its x and y postion. starting from the lowest layer

Trait Implementations§

source§

impl Clone for Map

source§

fn clone(&self) -> Map

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Map

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Map

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Map

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. 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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,