Stars Demo
This walkthrough creates a starfield demo in PhaserForge. It uses five Scatter formations, independent blinking, a shared movement cycle, and a typed Bounds event that rerolls each wrapped star's X position.
It assumes you already completed Cloud Account Setup and are continuing in the normal signed-in path.
What You Will Build
- a
720 x 1280scene with a solid black background - one imported
3 x 3white star image - five formations of 80 stars each, for 400 authored stars total
- deterministic random placement and bright random RGB tint for every star
- blink periods of
200,250,300,350, and400ms - a repeating vertical velocity cycle matching
stars.py - vertical wrapping with a new random X position for each wrapped star
Before You Start
- Open PhaserForge and sign in if needed.
- If you have other work going, reset to a new empty scene from the Project Tree: click
Manage -> Create New. - Open
Manage -> Project Settings...and leavePixels per Unitat2, then clickSaveorCancel. - Set the scene world size to
720 x 1280. UseFitto recenter the viewport.
Success check:
- The canvas is empty.
- The World Size fields show
720by1280.
Set the Scene Appearance
- Click an empty part of the canvas so the scene itself is selected.
- In the Inspector, open
Scene Appearance. - Set
BackgroundorHexto#000000.
Success check: the canvas background is black and the Inspector summary reads #000000.
Import the Star Image
The formation workflow needs an image asset to use as its template. Use a white 3 x 3 PNG. You can create one outside PhaserForge, or use an existing white 3 x 3 image.
- In the Assets Dock, click
+ Add. - Choose
From device...and select the white3 x 3PNG. - Confirm that the image appears under
Images.
If the image is larger than 3 x 3, the formation will still work, but the result will not have the tiny-star appearance of the reference demo.
Create the Five Star Formations
Create each formation from the same image. The five seeds keep the layouts deterministic while producing different member positions and tints.
For each row in the table, repeat the steps below.
| Formation name | Scatter seed | Blink period | Wrap X seed |
|---|---|---|---|
Stars Blink 1 | stars-1 | 200 ms | wrap-1 |
Stars Blink 2 | stars-2 | 250 ms | wrap-2 |
Stars Blink 3 | stars-3 | 300 ms | wrap-3 |
Stars Blink 4 | stars-4 | 350 ms | wrap-4 |
Stars Blink 5 | stars-5 | 400 ms | wrap-5 |
- In the Scene Graph, click
Formations -> + Add. - In the formation draft panel, choose the imported star image as
Template. - Set
Nameto the formation name from the table. - Set the preset to
ScatterandCountto80. - Enter these Scatter bounds:
Min X = 0,Max X = 720Min Y = 5,Max Y = 1285
- Enter the row's Scatter seed.
- Enable
Random tintand set every RGB channel range to20..255:Min R = 20,Max R = 255Min G = 20,Max G = 255Min B = 20,Max B = 255
- Click
Create. - Repeat for the remaining four rows.
The generated positions and tints are authored onto the individual members. The formation stores the Scatter settings so you can intentionally reroll or reapply them later.
Success check:
- The Scene Graph contains
Stars Blink 1throughStars Blink 5. - Expanding each formation shows 80 members.
- The five formations contain 400 distinct members in total.
- The stars are spread across the full viewport and have varied bright tints.
Add the Blink Actions
Attach one Blink Until action to each formation. Select the formation row in the Scene Graph before authoring its actions.
- Select
Stars Blink 1. - In Inspector, open
Actions/Eventsand click+ Add Actionin the normal scene-start action flow. - In the Action Library, choose
Blink Until. - In the action inspector, set
Apply To = MembersandSeconds Until Change = 0.20. - Leave
Start Visibleenabled and leaveStop Afterdisabled, so the action runs forever. - Repeat for formations 2–5 with
0.25,0.30,0.35, and0.40seconds.
Success check: each formation has one infinite Blink Until action, with the periods shown in the table.
Add Movement and Wrapping
Each formation needs a permanent Move Until action. This action translates members using their current velocity and detects the bounds outcome; the next section adds the consequence of a wrap.
For each formation:
- With the formation selected, open
Actions/Eventsand click+ Add Action. - In the Action Library, choose
Move Until. - Set
Apply To = Members,Velocity X = 0, andVelocity Y = 0. - In the
Untilsection, chooseBounds Hit. - Set the bounds to
Min X = 0,Min Y = -5,Max X = 720,Max Y = 1285. - Set
Behavior = Wrapand leave the action enabled indefinitely.
Do not add a randomization consequence inside Move Until. Bounds detection and behavior belong here; the reusable consequence is authored as an Event Block in the next section.
Reroll X When a Star Wraps
This is the no-code equivalent of the respawn-X part of stars.py.
For each formation:
- In
Actions/Events, click+ Add Event Block. - Set the trigger to
Bounds. - Choose
Event = Wrapped,Axis = Y, andSide = Any. - Rename the block to something recognizable, such as
When Stars Wrap. - In that event block's action list, click
+ Add Actionand chooseSet Property. - In the action inspector, set:
Target = Event sourceProperty = XValue = Random rangeMin = 0,Max = 720Seedto the row's Wrap X seed (wrap-1throughwrap-5)
- Leave the action attached to the Bounds event block.
The wiring summary should read like: When Stars wrap on Y -> Set event source X to random 0..720.
Success check: each formation has one Bounds/Wrapped event block and one Set Property action targeting Event source, not the formation owner. This distinction is what gives each individual wrapped star a new X position.
Add the Shared Velocity Cycle
The reference uses Arcade velocity values per frame. PhaserForge authors velocity in pixels per second, so use -240 instead of -4, and 840 instead of 14.
Create one infinite Repeat action on each formation, with Apply To = Members. Leave its Count blank. Add these six actions as children of the Repeat, in this order:
| Child | Action and values |
|---|---|
| 1 | Wait, Duration = 1000 ms |
| 2 | Tween Until, Property = vy, From = Current value, End value = -240, Duration = 2000 ms, Easing = ease-in |
| 3 | Wait, Duration = 5000 ms |
| 4 | Tween Until, Property = vy, From = Current value, End value = 840, Duration = 500 ms, Easing = ease-out |
| 5 | Wait, Duration = 1500 ms |
| 6 | Tween Until, Property = vy, From = Current value, End value = 0, Duration = 2000 ms, Easing = ease-out |
To build the tree, add Repeat first, then use its ... menu and Add Action as Child for each child. Open each child row to edit its values, then use Back to Actions/Events to return to the tree. Keep Blink Until, Move Until, and Repeat as parallel top-level actions; they must all run at the same time.
Repeat the same six-child sequence for all five formations. The complete cycle is 12 seconds.
Success check:
- Each formation has three parallel top-level behaviors: Blink, Move, and Repeat.
- The velocity is
0for the first second, eases to-240over two seconds, holds for five seconds, eases to840over 500 ms, holds for 1.5 seconds, then eases back to0over two seconds.
Verify the Finished Starfield
- Save the project and toggle
Play Modewith the toolbar button orTab. - Let it run for at least 12 seconds.
- Watch for:
- 400 stars remaining present;
- five visibly different blink rates;
- stars moving continuously rather than only at phase boundaries;
- stars leaving through one vertical edge and re-entering at the opposite edge;
- wrapped stars returning at varied X positions instead of forming vertical columns;
- the black background remaining unchanged.
- Toggle back to
Edit Mode.
For a persistence check, reload the project and confirm the five formations, their member counts, their tint variation, the five event blocks, and the nested velocity sequences are still present. You can also use Manage -> Export as YAML, then import that YAML into a temporary project and confirm the same structure.
What to Do Next
Continue to Publish to GitHub Pages when the starfield behaves as expected.