pub fn xy_idx(&self, x: i32, y: i32) -> usize {
        // multiplies the y position by the map width, and adds x.
        // This guarantees one tile per location
        // and efficiently maps it in memory for left-to-right reading.
        (y as usize * self.width as usize) + x as usize
    }
/// returns which array index is at a given x/y position
returns which array index is at a given x/y position
returns which array index is at a given x / y position
pub fn xy_idx(&self, x: i32, y: i32) -> usize {
        // multiplies the y position by the map width, and adds x.
        // This guarantees one tile per location
        // and efficiently maps it in memory for left-to-right reading.
        (y as usize * self.width as usize) + x as usize
    }
pub fn xy_idx ( & self , x : i32 , y : i32 ) -> usize { // multiplies the y position by the map width, and adds x. // This guarantees one tile per location // and efficiently maps it in memory for left-to-right reading. ( y as usize * self . width as usize ) + x as usize }
returns which array index is at a given x/y position
returns which array index is at a given x / y position
&self
x
i32
y
i32
&self
x
i32
y
i32