Stage Architecture
Stage Class
Stages are groups of props rendered in PlayState:Display name of the stage
Default camera zoom level for this stage
Props that can be referenced by name in scripts
Stage Data Format
Stage data is stored in JSON files atassets/data/stages/[id].json:
Stage Data Fields
Stage data format version (currently “1.0.0”)
Display name for the stage
Default camera zoom level
Asset directory for stage props (for modding support)
Array of prop definitions (see below)
Position and settings for bf, dad, and gf
Stage Props
Props are the visual elements that make up a stage.Prop Data Structure
Basic Prop
Simple static image:Solid Color Prop
Create colored rectangles:assetPath starts with #, it’s treated as a color code, and scale defines the rectangle size.
Animated Props
Props with animations:Bopping Props
Props that bop to the music:danceEvery to the number of beats between bops (e.g., 1 = every beat, 2 = every other beat).
Z-Index System
ThezIndex determines render order:
Typical z-index ranges:
- Background layers: -1000 to 0
- Mid-ground props: 0 to 500
- Front-ground props: 500 to 999
- Girlfriend: 900
- Boyfriend/Dad: 1000
- Foreground overlays: 1001+
Parallax Scrolling
Thescroll property creates depth through parallax:
[1.0, 1.0]: Moves 1:1 with camera (foreground)[0.5, 0.5]: Moves half as much (mid-ground)[0.0, 0.0]: Static, doesn’t move (UI elements)[2.0, 2.0]: Moves twice as much (rare, special effects)
Character Positioning
Stages define where characters stand:Character Data Fields
Character position as [x, y] (at character’s feet)
Render order relative to props
Scale multiplier applied to character (in addition to character’s base scale)
Camera focus offset as [x, y] when focusing on this character
Camera System
Camera Zoom
The stage defines a default camera zoom:Camera Focus Points
The camera focuses on character positions:cameraFocusPoint:
- Boyfriend:
[-100, -100](left and up) - Dad:
[100, -100](right and up) - Girlfriend:
[0, 0](centered)
Camera Events
Stages can respond to camera events via scripts:Stage Props API
Accessing Props
Named props can be accessed in scripts:Prop Animation
Animate props dynamically:Adding Props at Runtime
Stage Lighting
Stages can implement lighting effects:Pixel Art Stages
For pixel-art stages, disable anti-aliasing:- Set
isPixel: trueon all props - Use integer scale factors (6 is common)
- Save sprites at native resolution, scale up in-engine
- Ensure characters also have
isPixel: true
Stage Scripts
Create custom stage behavior with scripts: File:assets/data/stages/myStage.hxs
Stage Loading
Stages are loaded viaStageRegistry:
- Loads JSON data from
assets/data/stages/[id].json - Creates
Stageinstance - Instantiates all props from
propsarray - Loads prop assets and animations
- Sorts props by z-index
- Positions characters based on
charactersdata - Applies camera zoom
- Calls
onCreate()event
