A game that is more than one scene needs a way from one to the next, so the graph can load one (#39)
game-maker / suite (push) Failing after 11m6s

Load scene sets a flag on the World like Stop and Restart do; the swap
happens after the tick, and the last wish of a tick wins. Exactly one
thing crosses over: the SharedState, so global variables and global
machines keep what they know while everything local is built anew.
Loading the scene that is already running rebuilds it, which is what
"reset the level" means when the score must survive.

A run starts either from the start scene (a new project field, set from
the asset panel and marked with an arrow in the list) or from whatever
scene is open. The toggle next to Play says which question is asked and
remembers the answer in localStorage: it is a way of working, not part
of the game.

Sounds no longer end because a scene ends. A voice belongs to the
behavior that started it and stops right after On destroy, so the scene
swap is no longer a special case at all. For the enemy that plays its
explosion and destroys itself in the same breath there is now a
detached input on Play sound.

The scene selector stays usable while a run plays, because a double
click in the asset panel already did the same thing unguarded. It moves
what the editor looks at, not what the run plays.
This commit is contained in:
admin committed 2026-09-15 13:24:26 +02:00
1 parent 30090fc48e
commit 1e9d21cd5d
30 files changed
+976 -57

No files matched your search

+25
View File
@@ -344,6 +344,31 @@ export class ResetAssetPropertyCommand extends AssetPropertyCommand {
}
}
/**
* Names the scene a real run begins with, or takes that name back (`''`). A deleted scene is not
* cleaned up here on purpose: the id then simply reads as none, and an undo of the deletion brings
* the start scene back with it.
*/
export class SetStartSceneCommand implements Command {
readonly label = 'Set start scene';
private previous = '';
constructor(private readonly sceneId: string) {}
execute(project: Project): void {
if (this.sceneId) {
const asset = requireAsset(project, this.sceneId);
if (asset.type !== 'scene') throw new CommandError(`${asset.name} is not a scene`);
}
this.previous = project.startSceneId;
project.startSceneId = this.sceneId;
}
undo(project: Project): void {
project.startSceneId = this.previous;
}
}
export class SetActiveSceneCommand implements Command {
readonly label = 'Switch scene';
private previous = '';