refactor: streamline Game class initialization and update layer names in overworld.json
This commit is contained in:
parent
ea9d912e2f
commit
d0c859aab4
4 changed files with 7 additions and 607 deletions
6
index.js
6
index.js
|
@ -69,7 +69,8 @@ const playerAnimations = {
|
|||
class Game extends GameObject {
|
||||
constructor({ canvas }) {
|
||||
super();
|
||||
|
||||
this.canvas = canvas;
|
||||
this.ctx = this.canvas.getContext("2d");
|
||||
const canvasResizer = new CanvasResizer({
|
||||
canvas: canvas,
|
||||
width: GAME_WIDTH,
|
||||
|
@ -96,9 +97,6 @@ class Game extends GameObject {
|
|||
});
|
||||
const fpsCounter = new FpsCounter();
|
||||
this.gameObjects = [canvasResizer, camera, fpsCounter];
|
||||
|
||||
this.canvas = canvas;
|
||||
this.ctx = this.canvas.getContext("2d");
|
||||
this.lastTime = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue