Add all temporaries tiles #80
BIN
crates/border-wars/assets/tiles/breeding.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
crates/border-wars/assets/tiles/casern.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
crates/border-wars/assets/tiles/castle.png
Normal file
After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
BIN
crates/border-wars/assets/tiles/mine.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
crates/border-wars/assets/tiles/outpost.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
crates/border-wars/assets/tiles/sawmill.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
crates/border-wars/assets/tiles/tower.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
crates/border-wars/assets/tiles/wall.png
Normal file
After Width: | Height: | Size: 26 KiB |
|
@ -15,6 +15,15 @@ pub type TilePosition = HexPosition<i32>;
|
||||||
/// The tile of the map.
|
/// The tile of the map.
|
||||||
#[derive(Component, Debug)]
|
#[derive(Component, Debug)]
|
||||||
pub enum Tile {
|
pub enum Tile {
|
||||||
|
/// The breeding tile.
|
||||||
|
Breeding,
|
||||||
|
|
||||||
|
/// The Casern tile.
|
||||||
|
Casern,
|
||||||
|
|
||||||
|
/// The castle tile.
|
||||||
|
Castle,
|
||||||
|
|
||||||
/// The hill tile.
|
/// The hill tile.
|
||||||
Hill,
|
Hill,
|
||||||
|
|
||||||
|
@ -23,4 +32,38 @@ pub enum Tile {
|
||||||
|
|
||||||
/// The forest tile.
|
/// The forest tile.
|
||||||
Forest,
|
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(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,7 @@ struct TilesSize(Vec2);
|
||||||
impl Tile {
|
impl Tile {
|
||||||
/// Returns the handle of the image of the tile.
|
/// Returns the handle of the image of the tile.
|
||||||
fn get_texture(&self, asset_server: &AssetServer) -> Handle<Image> {
|
fn get_texture(&self, asset_server: &AssetServer) -> Handle<Image> {
|
||||||
match self {
|
asset_server.load(format!("tiles/{}.png", self.to_text()))
|
||||||
Self::Grass => asset_server.load("tiles/grass.png"),
|
|
||||||
Self::Forest => asset_server.load("tiles/forest.png"),
|
|
||||||
Self::Hill => asset_server.load("tiles/hill.png"),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the size of the image of the tile.
|
/// Returns the size of the image of the tile.
|
||||||
|
@ -43,9 +39,17 @@ impl Tile {
|
||||||
/// this function in the future.
|
/// this function in the future.
|
||||||
pub const fn get_image_size(&self) -> Vec2 {
|
pub const fn get_image_size(&self) -> Vec2 {
|
||||||
match self {
|
match self {
|
||||||
Self::Grass => Vec2 { x: 184.0, y: 164.0 },
|
Self::Breeding => Vec2::new(184., 158.),
|
||||||
Self::Forest => Vec2 { x: 184.0, y: 138.0 },
|
Self::Casern => Vec2::new(184., 167.),
|
||||||
Self::Hill => Vec2 { x: 184.0, y: 181.0 },
|
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.),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|