fix boss tank cross brick
This commit is contained in:
@@ -45,6 +45,7 @@ class EnemyTank extends Tank {
|
||||
hp: cfg.hp,
|
||||
color: cfg.color,
|
||||
size: cfg.size,
|
||||
colliderSize: cfg.colliderSize || cfg.size,
|
||||
direction: DIRECTION.DOWN,
|
||||
});
|
||||
|
||||
@@ -176,10 +177,10 @@ class EnemyTank extends Tank {
|
||||
const vec = DIR_VECTORS[dir];
|
||||
const testX = this.x + vec.dx * TILE_SIZE;
|
||||
const testY = this.y + vec.dy * TILE_SIZE;
|
||||
const left = testX - this.halfSize;
|
||||
const top = testY - this.halfSize;
|
||||
const left = testX - this.colliderHalfSize;
|
||||
const top = testY - this.colliderHalfSize;
|
||||
|
||||
if (!mapManager.rectCollidesWithTerrain(left, top, this.size, this.size)) {
|
||||
if (!mapManager.rectCollidesWithTerrain(left, top, this.colliderSize, this.colliderSize)) {
|
||||
this.direction = dir;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user