From d7eab96f8a71786786e166a18509602a07cbce6e Mon Sep 17 00:00:00 2001 From: Nikita Iryupin Date: Mon, 3 May 2021 16:25:40 +0200 Subject: [PATCH] Tank movement and sprite fixed --- src/GameLogic/collisionManager.js | 2 +- src/GameLogic/gameField.js | 8 ++++---- src/Tanks/playerTank.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/GameLogic/collisionManager.js b/src/GameLogic/collisionManager.js index 61ef316..0827337 100644 --- a/src/GameLogic/collisionManager.js +++ b/src/GameLogic/collisionManager.js @@ -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; } diff --git a/src/GameLogic/gameField.js b/src/GameLogic/gameField.js index 34fba66..724a37f 100644 --- a/src/GameLogic/gameField.js +++ b/src/GameLogic/gameField.js @@ -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(); } diff --git a/src/Tanks/playerTank.js b/src/Tanks/playerTank.js index 79fcb57..8cbb780 100644 --- a/src/Tanks/playerTank.js +++ b/src/Tanks/playerTank.js @@ -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; }