feat(#10): remove redundancy
This commit is contained in:
parent
9f1d83bf45
commit
37a7b76d38
5 changed files with 22 additions and 45 deletions
|
@ -1,4 +1,4 @@
|
|||
import { eventEmitter } from "../event-emitter.js";
|
||||
import { EventEmitter } from "../event-emitter.js";
|
||||
|
||||
export class GameObject {
|
||||
constructor(options = {}) {
|
||||
|
@ -16,7 +16,7 @@ export class GameObject {
|
|||
this.height = height;
|
||||
this.gameObjects = gameObjects;
|
||||
this.debug = debug;
|
||||
this.eventEmitter = eventEmitter;
|
||||
this.eventEmitter = new EventEmitter();
|
||||
}
|
||||
|
||||
async load() {
|
||||
|
@ -52,9 +52,7 @@ export class GameObject {
|
|||
}
|
||||
|
||||
onMouseClick(elementId) {
|
||||
if (elementId === "debug") {
|
||||
this.debug = !this.debug;
|
||||
}
|
||||
if (elementId === "debug") this.debug = !this.debug;
|
||||
this.gameObjects.forEach((item) => {
|
||||
item.onMouseClick(elementId);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue