Pressure pad
A walkable pad that briefly lights up and plays a sound on arrival.
What it demonstrates: Walkability · cosmetic steps · procedural sound.
Run this example
All learning examples appear in a compatible developer world. To export a standalone project, an operator with source access runs this from the Scape repository (choose a new destination under an existing directory):
sh
yarn sdk:starter /path/to/my-pressure-pad --template pressure-pad1
In the exported project:
sh
yarn install
yarn build
yarn dev --origin https://your-scape-host1
2
3
2
3
Follow connection and approval. The exported dev script invokes scape gizmo dev. The kit includes three private archives for the SDK, CLI and MCP server; keep them and the Yarn resolutions together. Third-party dependencies still need installation. See the CLI reference for commands; no public Scape registry install is available yet.
Try changing it
Change the feedback duration or sound. Keep it cosmetic: the step callback does not mutate shared state.
Source
This code is included directly from the working example when the site builds.
src/definition.ts
ts
/** pressure-pad: SDK definition and authored behavior. Scape supplies the host services. */
import { defineObject, exactKeys, record } from '@scape/sdk';
/** Arrival feedback is temporary: there is no saved counter or permission-bearing action. */
export const pressurePad = defineObject<Record<string, never>>({
type: 'example.pressure-pad',
version: 1,
emoji: '🔘',
label: 'Pressure pad',
hint: 'walk or ride onto the pad to light it and play a note',
initial: () => ({}),
valid: (state): state is Record<string, never> => record(state) && exactKeys(state, []),
actions: {},
walkable: true,
sounds: {
note: {
kind: 'synth',
duration: 0.35,
voices: [
{
wave: 'sine',
start: 0,
duration: 0.3,
frequency: 523.25,
gain: 0.2,
},
{
wave: 'sine',
start: 0,
duration: 0.2,
frequency: 1046.5,
gain: 0.06,
},
],
},
},
// Scape supplies one arrival per observed move. Standing still does not repeat it.
step: (_state, event) => ({
durationMs: 600,
lighting: {
light: {
color: event.movement === 'push' ? '#a28aff' : '#6bdfff',
radiusCells: 2,
intensity: 0.16,
basementIntensity: 0.25,
illumination: 0.6,
},
glow: {
color: '#6bdfff',
size: 65,
pulse: {
speed: 0,
amount: 0,
phaseX: 0,
},
opacity: {
base: 0.3,
amount: 0,
speed: 0,
phaseY: 0,
},
},
},
audio: [
{
kind: 'play',
voice: 'note',
sound: 'note',
delayMs: 0,
gain: 0.6,
rate: 1,
loop: false,
rangeCells: [1, 8],
stereo: 0.7,
},
],
}),
});
export default pressurePad;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
src/project.ts
ts
/** Project entry: exports pressure-pad to Scape's SDK loader. */
import { defineProject } from '@scape/sdk';
import { pressurePad } from './definition.js';
export default defineProject({ objects: [pressurePad] });1
2
3
4
5
2
3
4
5
