We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1db75ce commit 76369b7Copy full SHA for 76369b7
1 file changed
src/entity_manager.ts
@@ -14,6 +14,20 @@ class EntityManager {
14
#entitiesUpdated: Entity[] = [];
15
16
constructor() {
17
+ game.on('frame', () => {
18
+ this.#entities = this.#entitiesUpdated;
19
+ this.#entitiesUpdated = [];
20
+ });
21
+ }
22
+
23
+ get entities(): Entity[] {
24
+ return this.#entities;
25
26
27
+ /**
28
+ * Calling this method is mandatory to start recording entities.
29
+ */
30
+ initialize(): void {
31
this.#triangleHook();
32
33
this.#squareHook();
@@ -24,15 +38,6 @@ class EntityManager {
38
39
//when is a player being drawn?
40
this.#playerHook();
-
- game.on('frame', () => {
- this.#entities = this.#entitiesUpdated;
- this.#entitiesUpdated = [];
- });
- }
34
- get entities(): Entity[] {
35
- return this.#entities;
36
41
}
37
42
43
/**
0 commit comments