Set different default size of canvas

This commit is contained in:
Nikita Iryupin 2021-04-30 12:14:45 +02:00
parent 256a85d51b
commit c2668dd3bd
2 changed files with 3 additions and 3 deletions

View File

@ -7,6 +7,6 @@
<script src='bundle.js'></script>
</head>
<body>
<canvas id="canvas" height="1000" width="1000"></canvas>
<canvas id="canvas"></canvas>
</body>
</html>

View File

@ -5,13 +5,13 @@ export function init() {
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
if (ctx) {
const game = new Game(500, 500, ctx, canvas);
const game = new Game(416, 416, ctx, canvas);
game.start();
}
}
export class Game {
constructor(width = 500, height = 500, ctx) {
constructor(width = 416, height = 416, ctx) {
this.gameField = new GameField(width, height, ctx, canvas);
this.gameKeyAdapter = new TankKeyAdapter(this.gameField.tank);
}