Fixes a bug
This commit is contained in:
parent
0bc6dcdf02
commit
dec099ad32
|
@ -336,8 +336,9 @@ impl Map {
|
|||
self.collision_tiles[(i, j)] = tile;
|
||||
|
||||
// Refresh the current graphic tile and their neighbours
|
||||
for i in (i - 1) ..= (i + 1) {
|
||||
for j in (j - 1) ..= (j + 1) {
|
||||
use std::cmp::max;
|
||||
for i in max(i, 1) - 1 ..= (i + 1) {
|
||||
for j in max(j, 1) - 1 ..= (j + 1) {
|
||||
let new_tile = self.graphic_tile(i, j);
|
||||
if let Some(tile) = self.graphic_tiles.get_mut(i, j) {
|
||||
*tile = new_tile;
|
||||
|
@ -399,8 +400,8 @@ impl Map {
|
|||
let mut collision_y = false;
|
||||
let mut new = new;
|
||||
|
||||
for col in min_col..=max_col {
|
||||
for row in min_row..=max_row {
|
||||
for col in min_col ..= max_col {
|
||||
for row in min_row ..= max_row {
|
||||
let tile_left = col as f32 * SPRITE_SIZE_F32;
|
||||
let tile_top = row as f32 * SPRITE_SIZE_F32;
|
||||
|
||||
|
|
Loading…
Reference in New Issue