Skip to content

1.23 - Prefabs, custom level editor, parallax

Choose a tag to compare

@KilledByAPixel KilledByAPixel released this 02 Oct 02:19
· 366 commits to main since this release

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, and level3DSpawn places one from code; each part is a solid object of its own, or with attached the 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, addButton and addTool add a key, a panel button and a mouse tool of your game's own, onOpen, onUpdate, onDraw, onPanel and onSave are called by the editors, and levelEditor.edit2D and edit3D are 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 LevelEditor with the hooks as methods, then setLevelEditor(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 ParallaxLayer follows 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, and touchPinch reads 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 LensFlare3D can be a light's flare: set flare.light and 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.range can 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 SpriteAnimator clip 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 ParticleEmitter3D makes its first particle at once, where it used to wait one emit interval
  • A spotlight set as render3D.shadowLight has its cone capped at 1.35 radians, what its shadow map covers
  • levelEditor.onRestart, onPlayFrom and onTile are set the same way as before, but they are now empty methods when a game has not set them, so if (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: collideTiles is now collideLevel, and Box2dWeldJoint.setSpringDampingRatio is now setDampingRatio

Check out the latest on GitHub to see everything we've been working on!

render3dLevelEditor render3dPrefab parallax