Tank movement and sprite fixed

This commit is contained in:
Nikita Iryupin 2021-05-03 16:25:40 +02:00
parent 86e0b45a2f
commit d7eab96f8a
3 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@ export class CollisionManager {
_checkBoundaries(xMin, xMax, yMin, yMax) {
const tilesize = Constants.TILE_SIZE.getValue();
if (xMin < 0 || yMin < 0 || xMax >= this._map.width * tilesize || yMax >= this._map.height * tilesize)
if (xMin < 0 || yMin < 0 || xMax > this._map.width * tilesize || yMax > this._map.height * tilesize)
return CollisionTypeEnum.Edge;
return null;
}

View File

@ -38,10 +38,10 @@ export class GameField {
this.tileset.addTile(544, 64, 32, 32, BlockTypeEnum.Forest);
//Tank
this.tileset.addTile(0, 0, 30, 30, 101);
this.tileset.addTile(64, 0, 32, 30, 102);
this.tileset.addTile(128, 0, 32, 30, 103);
this.tileset.addTile(192, 0, 32, 30, 104);
this.tileset.addTile(0, 2, 28, 30, 101);
this.tileset.addTile(64, 0, 28, 28, 102);
this.tileset.addTile(128, 0, 28, 28, 103);
this.tileset.addTile(192, 0, 28, 28, 104);
await this.tileset.loadAll();
}

View File

@ -7,7 +7,7 @@ export class PlayerTank {
this.x = x;
this.y = y;
this.collisionManager = collisionManager;
this.speed = 4.0;
this.speed = 3.0;
this.direction = DirectionEnum.Up;
}