You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Parts/Camera.ts
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,11 @@ export class Camera extends Part {
40
40
// Could be used in rendering context
41
41
consttransform=this.child<Transform>("Transform")
42
42
if(!transform){
43
-
this.top?.warn(`Camera <${this.name}> (${this.id}) does not have a Transform component. View matrix will not be calculated.`);
43
+
if(!this.warned.has("TransformMissing")){
44
+
// Warn only once about missing Transform component
45
+
constseen=this.top?.warn(`Camera <${this.name}> (${this.id}) does not have a Transform component. View matrix will not be calculated.`);
46
+
if(seen)this.warned.add("TransformMissing");
47
+
}
44
48
return{offset: Vector.From(0),scale: this.zoom};
45
49
}
46
50
return{
@@ -55,7 +59,9 @@ export class Camera extends Part {
55
59
if(transform){
56
60
this.zoom=transform.scale;
57
61
}else{
58
-
this.top?.warn(`Camera <${this.name}> (${this.id}) does not have a Transform component. Camera zoom will not be updated.`);
62
+
if(!this.warned.has("TransformMissing")){
63
+
this.top?.warn(`Camera <${this.name}> (${this.id}) does not have a Transform component. Camera zoom will not be updated.`) ? this.warned.add("TransformMissing") : null;
this.top?.warn(`AnimatedSprite <${this.name}> attached to ${this.parent?.name} does not have a Transform component. Skipping rendering. This will only show once.`);
245
-
this.hasWarnedAboutTransform=true;
242
+
if(!this.warned.has("TransformMissing")){
243
+
constseen=this.top?.warn(`AnimatedSprite <${this.name}> attached to ${this.parent?.name} does not have a Transform component. Skipping rendering. This will only show once.`);
@@ -170,11 +170,12 @@ export class Game extends Part {
170
170
171
171
pause(){
172
172
this._isPaused=true;
173
+
this.debug("Game paused");
173
174
SoundManager.pauseGame();
174
-
175
175
}
176
176
177
177
resume(){
178
+
this.debug("Game resumed");
178
179
this._isPaused=false;
179
180
SoundManager.resumeGame();
180
181
}
@@ -203,9 +204,9 @@ export class Game extends Part {
203
204
}
204
205
205
206
act(purposeful: boolean|number=false){
206
-
if(!this.hasWarnedActUsage&&!purposeful){
207
-
this.warn(`Act called on Game <${this.name}>. Use start() to begin the game loop. Calling act() directly will run 1 frame of the current scene. This message will appear only once.`);
208
-
this.hasWarnedActUsage=true;
207
+
if(!this.warned.has("ActUsage")&&!purposeful){
208
+
constseen=this.warn(`Act called on Game <${this.name}>. Use start() to begin the game loop. Calling act() directly will run 1 frame of the current scene. This message will appear only once.`);
209
+
if(seen)this.warned.add("ActUsage");
209
210
}
210
211
if(this.currentScene){
211
212
this.currentScene.act(0);
@@ -229,22 +230,28 @@ export class Game extends Part {
0 commit comments