Repository navigation
1.23 - Prefabs, custom level editor, parallax
New Demos
- 3D Prefab Maker - Build a prefab in the level editor and save it for a game to place
- 3D Level Editor - Now makes prefabs, flattens and paints terrain, and fills boxes of blocks
- Parallax - Rebuilt on the new parallax plugin, with ranges of mountains that repeat as the camera goes by
New Changes
- 3D prefabs: a prefab is a small level placed many times.
level3DAddPrefab('House', data)makes it a type, a level places it like a Box, andlevel3DSpawnplaces one from code; each part is a solid object of its own, or withattachedthe parts move with the instance as one body, for a vehicle or a creature - The 3D level editor is the prefab editor too: Ctrl+G makes the selection a prefab, Enter opens one to edit it alone and every instance follows, Ctrl+Shift+G unpacks one, and the panel exports a prefab to a file and loads one from a file; prefabs can hold prefabs, and are saved in the level
- Make the level editors your own:
levelEditor.addKey,addButtonandaddTooladd a key, a panel button and a mouse tool of your game's own,onOpen,onUpdate,onDraw,onPanelandonSaveare called by the editors, andlevelEditor.edit2Dandedit3Dare the edit functions, each change an undo step. The same calls work in the 2D and the 3D editor - Or extend it:
class MyEditor extends LevelEditorwith the hooks as methods, thensetLevelEditor(new MyEditor). Release builds take all of it and call none of it, so a game needs no guards - New guide, EDITOR.md: how to turn the built-in editors into an editor for your own game, written for people and AI assistants, with every example tested
- Added the Parallax plugin: a
ParallaxLayerfollows the camera by a part of its movement and repeats across the view, so a level of any width has a background; it draws mountains by default, or anything you draw into it - Touch has a mouse wheel: a pinch of two fingers turns
mouseWheel, so what zooms with the wheel zooms with a pinch, andtouchPinchreads it by itself - 3D level editor: the Terrain tool has a flatten brush and a paint brush that colors the ground, the Blocks tool fills a box with a drag and resizes its map, and the Move handles can follow an object's own axes (L)
- A
LensFlare3Dcan be a light's flare: setflare.lightand it sits at the lamp, in its color, hidden by what is in front of it - The example browser has Prev and Next buttons, to go through the examples on a phone
Sound.rangecan be set after a sound is made, and 3D sounds use it- Size: the full build is about 122 KB gzipped, up from 119 KB; a bundler like Vite leaves out the plugins you don't use
- Fixes: a
SpriteAnimatorclip that ends and switches clips reads the new clip, glass and water blocks no longer hide the sun's lens flare, 3D particles appear at once like 2D ones, a spotlight that casts shadows lights no wider than its shadow map, the 3D editor's Scene box no longer undoes a field edited just before, and the example browser always shows the example picked last; the test suite grew from 1724 to 1848 tests
Upgrade Notes
- With two fingers down the touch screen pinches: the second finger lets go of the button the first one pressed. A game that uses two fingers its own way calls
setTouchPinchWheel(false)to get the old behavior back - A
ParticleEmitter3Dmakes its first particle at once, where it used to wait one emit interval - A spotlight set as
render3D.shadowLighthas its cone capped at 1.35 radians, what its shadow map covers levelEditor.onRestart,onPlayFromandonTileare set the same way as before, but they are now empty methods when a game has not set them, soif (levelEditor.onRestart)is always true; nothing in a game needs to read them- The Parallax short moved to the plugins section, and the platformer example uses the plugin for its mountains
- These names changed in 1.20 and the old ones still work for now:
collideTilesis nowcollideLevel, andBox2dWeldJoint.setSpringDampingRatiois nowsetDampingRatio
Check out the latest on GitHub to see everything we've been working on!
