Set different default size of canvas
This commit is contained in:
parent
256a85d51b
commit
c2668dd3bd
@ -7,6 +7,6 @@
|
|||||||
<script src='bundle.js'></script>
|
<script src='bundle.js'></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<canvas id="canvas" height="1000" width="1000"></canvas>
|
<canvas id="canvas"></canvas>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -5,13 +5,13 @@ export function init() {
|
|||||||
const canvas = document.getElementById("canvas");
|
const canvas = document.getElementById("canvas");
|
||||||
const ctx = canvas.getContext("2d");
|
const ctx = canvas.getContext("2d");
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
const game = new Game(500, 500, ctx, canvas);
|
const game = new Game(416, 416, ctx, canvas);
|
||||||
game.start();
|
game.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Game {
|
export class Game {
|
||||||
constructor(width = 500, height = 500, ctx) {
|
constructor(width = 416, height = 416, ctx) {
|
||||||
this.gameField = new GameField(width, height, ctx, canvas);
|
this.gameField = new GameField(width, height, ctx, canvas);
|
||||||
this.gameKeyAdapter = new TankKeyAdapter(this.gameField.tank);
|
this.gameKeyAdapter = new TankKeyAdapter(this.gameField.tank);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user