Enabled switch, text assets, mouse input and the jump-and-run example game
Engine additions that the example game needed: - `enabled` as a shared property of every placeable asset (default on, an override on the scene object). A switched-off object is not drawn, does not collide and its behavior does not run - and neither does anything parented below it. Disabled objects are now hidden in the scene view as well, so the editor shows what the game shows; they stay in the hierarchy panel, which is where they are selected and switched back on. - Asset type `text` (text, fontSize, color, align), rendered in scene and game. - Pointer input in the game view: `On click`, `Mouse position`, `Mouse button`, `Is hovered`, hit-tested against colliders, else sprite/text footprints. - New nodes: Set/Is enabled, Set text, Is asset, Name of, Equals, To text, Join text, Floor/Ceil/Round, Modulo, Random, Time, Restart game. Tooling: shared CDP harness (tools/harness.mjs), central project registry with a guard that keeps destructive scripts off the playground (tools/projects.mjs), plus smoke suites for the demo scene and the jump-and-run game. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4900d7bbf6
commit
76aa441dce
33 files changed
+1905
-301
No files matched your search
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Which project each tool writes to, and the guard that keeps the checks away from the
|
||||
* playground.
|
||||
*
|
||||
* demo the project served at ?project=… in the browser. It is the user's playground;
|
||||
* only tools/seed-demo.mjs may overwrite it, and only when asked.
|
||||
* fixture rewritten by every e2e run. tools/e2e.mjs mutates it heavily.
|
||||
* demoCheck a throwaway copy of the demo scene for tools/smoke-demo.mjs.
|
||||
* jumpRun the example game (tools/seed-jumprun.mjs, checked by tools/smoke-jumprun.mjs).
|
||||
*
|
||||
* All ids exist on the server (created via POST ?r=projects); PUT does not create projects.
|
||||
*/
|
||||
export const PROJECTS = {
|
||||
demo: '649188c15414',
|
||||
fixture: '3caa9b6a0c92',
|
||||
demoCheck: 'aaf5e962ef9c',
|
||||
jumpRun: '3d271f3bb58b',
|
||||
};
|
||||
|
||||
export const DEFAULT_BASE_URL = 'https://nockal.com/game-maker/';
|
||||
|
||||
/**
|
||||
* Reads `[projectId] [baseUrl]` from argv, falling back to `defaultId`. Unless `allowDemo` is
|
||||
* set, targeting the demo project aborts: a destructive run must never hit the playground.
|
||||
*/
|
||||
export function cliArgs(script, defaultId, { allowDemo = false } = {}) {
|
||||
const projectId = process.argv[2] ?? defaultId;
|
||||
const baseUrl = process.argv[3] ?? DEFAULT_BASE_URL;
|
||||
if (!projectId) {
|
||||
console.error(`usage: node tools/${script} <projectId> [baseUrl]`);
|
||||
process.exit(2);
|
||||
}
|
||||
if (!allowDemo && projectId === PROJECTS.demo) {
|
||||
console.error(`refusing to run ${script} against the demo project (${PROJECTS.demo}) – it is the playground.`);
|
||||
process.exit(2);
|
||||
}
|
||||
return { projectId, baseUrl };
|
||||
}
|
||||
|
||||
/** Overwrites a project, keeping the name it already has on the server. */
|
||||
export async function writeProject(projectId, baseUrl, project) {
|
||||
const url = `${baseUrl}api/index.php?r=projects/${projectId}`;
|
||||
const current = await fetch(url);
|
||||
if (!current.ok) {
|
||||
console.error(`GET failed: ${current.status} – create the project first (POST ?r=projects)`);
|
||||
process.exit(1);
|
||||
}
|
||||
const doc = await current.json();
|
||||
const body = { revision: doc.revision, project: { ...project, id: projectId, name: doc.name ?? project.name } };
|
||||
const res = await fetch(url, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
||||
const result = await res.json();
|
||||
if (!res.ok) {
|
||||
console.error('PUT failed', res.status, result);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`seeded ${projectId} (${body.project.name}) → revision ${result.revision}`);
|
||||
}
|
||||
Reference in new issue
Block a user