dev-tools with dynamically added scenes #2399
-
Hey hey Excalibur team, Before raising an issue or PR I would like to double check if I'm doing something wrong (which is highly probable) If I add a scene "dynamically", after the game has started, it is not reflected in the scene dropdown in the dev-tools. Is this a bug or am I misusing scenes by adding them post-start? Example:export class Game extends Engine {
private area: Area | null = null;
public teleport(area: string, tileX: number, tileY: number) {
// Clean up existing
if (this.area) {
this.remove(this.area);
}
// Update store
changeArea(area, tileX, tileY);
// Update scene
this.area = new Area();
this.add('area', this.area);
this.goToScene('area');
}
} NextIf scenes should only be added once at the start, I might open a PR to the docs under https://excaliburjs.com/docs/scenes#adding-a-scene If this is an issue with dev-tools, I can look at a PR there instead. Possibly extract the scene pane into its own handler that can be called on update? Or would it be better to listen to some engine event, then update the pane? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
@chrisk-7777 I'd call this a bug in the dev-tools, it's completely reasonable to add a scene dynamically during the course of a game 👍 The dev-tools should handle new scenes being added. I think both suggestions are good ways to tackle this, and would support either approaches
Apologies, the dev-tools are definitely a minimum viable product. I'm sure there are more than a few quirks in there. |
Beta Was this translation helpful? Give feedback.
@chrisk-7777 I'd call this a bug in the dev-tools, it's completely reasonable to add a scene dynamically during the course of a game 👍 The dev-tools should handle new scenes being added.
I think both suggestions are good ways to tackle this, and would support either approaches
sceneadded
/sceneremoved
event to excalibur that can be listened to in the dev-tools (this event might be a useful feature for excalibur in general!)Apologies, the dev-tools are definitely a minimum viable product. I'm sure there are more than a few quirks in there.