Add all temporaries tiles (#80)
All checks were successful
Rust Checks / checks (push) Successful in 3m26s

Reviewed-on: fish-canard/border-wars#80
Reviewed-by: Raphaël <r.lauray@outlook.fr>
Co-authored-by: CoCo_Sol007 <solois.corentin@gmail.com>
Co-committed-by: CoCo_Sol007 <solois.corentin@gmail.com>
This commit is contained in:
CoCo_Sol 2024-03-12 17:05:53 +00:00 committed by CoCo_Sol
parent 4565e56f69
commit 64280ab3ff
13 changed files with 55 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -15,6 +15,15 @@ pub type TilePosition = HexPosition<i32>;
/// The tile of the map.
#[derive(Component, Debug)]
pub enum Tile {
/// The breeding tile.
Breeding,
/// The Casern tile.
Casern,
/// The castle tile.
Castle,
/// The hill tile.
Hill,
@ -23,4 +32,38 @@ pub enum Tile {
/// The forest tile.
Forest,
/// The mine tile.
Mine,
/// The outpost tile
Outpost,
/// The sawmill tile
Sawmill,
/// The tower tile
Tower,
/// The wall tile
Wall,
}
impl Tile {
/// Returns the text representation of the tile.
pub fn to_text(&self) -> String {
match self {
Self::Breeding => "breeding".to_string(),
Self::Casern => "casern".to_string(),
Self::Castle => "castle".to_string(),
Self::Forest => "forest".to_string(),
Self::Grass => "grass".to_string(),
Self::Hill => "hill".to_string(),
Self::Mine => "mine".to_string(),
Self::Outpost => "outpost".to_string(),
Self::Sawmill => "sawmill".to_string(),
Self::Tower => "tower".to_string(),
Self::Wall => "wall".to_string(),
}
}
}

View file

@ -30,11 +30,7 @@ struct TilesSize(Vec2);
impl Tile {
/// Returns the handle of the image of the tile.
fn get_texture(&self, asset_server: &AssetServer) -> Handle<Image> {
match self {
Self::Grass => asset_server.load("tiles/grass.png"),
Self::Forest => asset_server.load("tiles/forest.png"),
Self::Hill => asset_server.load("tiles/hill.png"),
}
asset_server.load(format!("tiles/{}.png", self.to_text()))
}
/// Returns the size of the image of the tile.
@ -43,9 +39,17 @@ impl Tile {
/// this function in the future.
pub const fn get_image_size(&self) -> Vec2 {
match self {
Self::Grass => Vec2 { x: 184.0, y: 164.0 },
Self::Forest => Vec2 { x: 184.0, y: 138.0 },
Self::Hill => Vec2 { x: 184.0, y: 181.0 },
Self::Breeding => Vec2::new(184., 158.),
Self::Casern => Vec2::new(184., 167.),
Self::Castle => Vec2::new(192., 196.),
Self::Forest => Vec2::new(184., 165.),
Self::Grass => Vec2::new(184., 138.),
Self::Hill => Vec2::new(184., 181.),
Self::Mine => Vec2::new(184., 166.),
Self::Outpost => Vec2::new(184., 208.),
Self::Sawmill => Vec2::new(184., 138.),
Self::Tower => Vec2::new(184., 218.),
Self::Wall => Vec2::new(184., 186.),
}
}
}