This commit is contained in:
2024-03-28 09:41:25 -04:00
parent c4da9ab87a
commit 402b8eb93c
2 changed files with 37 additions and 4 deletions

View File

@@ -139,12 +139,12 @@ impl HexCoord {
return (hex * -1).zxy();
}
pub fn scale(&self, dir: i32, radius: i32)-> HexCoord{
let s = Self::DIRECTIONS[dir % 6] * radius;
pub fn scale(&self, dir: i32, radius: usize)-> HexCoord{
let s = Self::DIRECTIONS[(dir % 6) as usize] * radius as i32;
return Self::from_offset(self.hex.xy() + s.xy());
}
pub fn get_neighbor(&self, dir: i32)-> HexCoord{
pub fn get_neighbor(&self, dir: usize)-> HexCoord{
let d = Self::DIRECTIONS[dir % 6];
return Self::from_offset(self.hex.xy() + d.xy());
}