updated asset loader

prep for adding biomes
This commit is contained in:
2024-04-18 22:09:50 -04:00
parent 9fb305a887
commit df76dc7169
6 changed files with 60 additions and 19 deletions

View File

@@ -128,15 +128,15 @@ impl HexCoord {
return IVec2::new(self.hex.x + (self.hex.y / 2), self.hex.y);
}
pub fn to_index(&self, width: usize) -> i32 {
return (self.hex.x + self.hex.y * width as i32) + (self.hex.y / 2);
pub fn to_index(&self, width: usize) -> usize {
return ((self.hex.x + self.hex.y * width as i32) + (self.hex.y / 2)) as usize;
}
pub fn to_chunk_index(&self, width: usize) -> i32 {
pub fn to_chunk_index(&self, width: usize) -> usize {
let pos = self.to_chunk_pos();
return pos.x + pos.y * width as i32;
return (pos.x + pos.y * width as i32) as usize;
}
pub fn to_chunk_local_index(&self) -> i32 {
pub fn to_chunk_local_index(&self) -> usize {
return self.to_chunk().to_index(Chunk::SIZE);
}