Excalibur v0.25.0 Release
See migration guide for v0.24.5 -> v0.25.0
We've had tons of community contributions since the last release. Heartfelt thanks to everyone in the discussions, issues and PRs!
Contributors:
- @jedeen
- @kamranayub
- @alanag13
- @DaVince
- @DrSensor
- @djcsdy
- @catrielmuller
- @AndrewCraswell
- @miqh
- @rledford
- @SirPedr
- @helloausrine
- @dpayne5
- @herobank110
- @didii
- @Charkui
- @muirch
- @rumansaleem
- @mogoh
- @kala2
- @MrBartusek
- @josh
- @LokiMidgard
- @romaintailhurat
- @EduardoHidalgo
- @jaredegan
Breaking Changes
-
Actor Drawing:
ex.Actor.addDrawing,ex.Actor.setDrawing,onPostDraw(), andonPreDraw()are no longer on by default and will be removed in v0.26.0, they are available behind a flagex.Flags.useLegacyDrawing()- For custom drawing use the
ex.Canvas
- For custom drawing use the
-
ex.Actor.rxhas been renamed toex.Actor.angularVelocity -
Rename
ex.Edgetoex.EdgeColliderandex.ConvexPolygontoex.PolygonColliderto avoid confusion and maintian consistency -
ex.Labelconstructor now only takes the option bag constructor and the font properties have been replaced withex.Fontconst label = new ex.Label({ text: 'My Text', x: 100, y: 100, font: new ex.Font({ family: 'Consolas', size: 32 }) });
-
ex.Physics.debugproperties for Debug drawing are now moved toengine.debug.physics,engine.debug.collider, andengine.debug.body.- Old
debugDraw(ctx: CanvasRenderingContext2D)methods are removed.
- Old
-
Collision
Pair's are now between Collider's and not bodies -
PerlinNoisehas been removed from the core repo will now be offered as a plugin -
Legacy drawing implementations are moved behind
ex.LegacyDrawingnew Graphics implemenations ofSprite,SpriteSheet,Animationare now the default import.- To use any of the
ex.LegacyDrawing.*implementations you must opt-in with theex.Flags.useLegacyDrawing()note: new graphics do not work in this egacy mode
- To use any of the
-
Renames
CollisionResolutionStrategy.Boxcollision resolution strategy toArcade -
Renames
CollisionResolutionStrategy.RigidBodycollision resolution strategy toRealistic -
Collideris now a first class type and encapsulates whatShapeused to be.Collideris no longer a member of theBody -
CollisionTypeandCollisionGroupare now a member of theBodycomponent, the reasoning is they define how the simulated physics body will behave in simulation. -
Timer's no longer automatically start when added to aScene, thisTimer.start()must be called. (#1865) -
Timer.completeis now read-only to prevent odd bugs, usereset(),stop(), andstart()to manipulate timers. -
Actor.actions.repeat()andActor.actions.repeatForever()now require a handler that specifies the actions to repeat. This is more clear and helps prevent bugs like #1891const actor = new ex.Actor(); actor.actions // Move up in a zig-zag by repeating 5 times .repeat((ctx) => { ctx.moveBy(10, 0, 10); ctx.moveBy(0, 10, 10); }, 5) .callMethod(() => { console.log('Done repeating!'); });
-
Removes
Entity.componentsas a way to access, add, and remove components -
ex.Camera.zhas been renamed to propertyex.Camera.zoomwhich is the zoom factor -
ex.Camera.zoom(...)has been renamed to functionex.Camera.zoomOverTime() -
TileMap no longer needs registered SpriteSheets,
Sprite's can be added directly toCell's withaddGraphic- The confusing
TileSpritetype is removed (Related to TileMap plugin updates excaliburjs/excalibur-tiled#4, excaliburjs/excalibur-tiled#23, excaliburjs/excalibur-tiled#108)
- The confusing
-
Directly changing debug drawing by
engine.isDebug = valuehas been replaced byengine.showDebug(value)andengine.toggleDebug()(#1655) -
UIActorClass instances need to be replaced toScreenElement(This Class it's marked as Obsolete) (#1656) -
Switch to browser based promise, the Excalibur implementation
ex.Promiseis marked deprecated (#994) -
DisplayMode's have changed (#1733) & (#1928):DisplayMode.FitContainerfits the screen to the available width/height in the canvas parent element, while maintaining aspect ratio and resolutionDisplayMode.FillContainerupdate the resolution and viewport dyanmically to fill the available space in the canvas parent element, DOES NOT preserveaspectRatioDisplayMode.FitScreenfits the screen to the available browser window space, while maintaining aspect ratio and resolutionDisplayMode.FillScreennow does whatDisplayMode.FullScreenused to do, the resolution and viewport dynamically adjust to fill the available space in the window, DOES NOT preserveaspectRatio(#1733)DisplayMode.FullScreenis now removed, useScreen.goFullScreen().
-
SpriteSheetnow is immutable after creation to reduce chance of bugs if you modified a public field. The following properties are read-only:columns,rows,spWidth,spHeight,image,spritesandspacing. -
Engine.pointerScopenow defaults to a more expectedex.Input.PointerScope.Canvasinstead ofex.Input.PointerScope.Documentwhich can cause frustrating bugs if building an HTML app with Excalibur
Added
- New property
centertoScreento encapsulate screen center coordinates calculation considering zoom and device pixel ratio - New
ex.Shape.Capsule(width, height)helper for defining capsule colliders, these are useful for ramps or jagged floor colliders. - New collision group constructor argument added to Actor
new Actor({collisionGroup: collisionGroup}) SpriteSheet.getSprite(x, y)can retrieve a sprite from the SpriteSheet by x and y coordinate. For example,getSprite(0, 0)returns the top left sprite in the sheet.SpriteSheet's now have dimensionality withrowsandcolumnsoptionally specified, if not there is always 1 row, andsprites.lengthcolumns
new Actor({radius: 10})can now take a radius parameter to help create circular actors- The
ExcaliburGraphicsContextnow supports drawing debug text Entitymay also now optionally have aname, this is useful for finding entities by name or when displaying in debug mode.- New
DebugSystemECS system will show debug drawing output for things toggled on/off in theengine.debugsection, this allows for a less cluttered debug experience.- Each debug section now has a configurable color.
- Turn on WebGL support with
ex.Flags.useWebGL() - Added new helpers to
CollisionGroupto define groups that collide with specified groupsCollisionGroup.collidesWith([groupA, groupB])- Combine groups with
const groupAandB = CollisionGroup.combine([groupA, groupB]) - Invert a group instance
const everthingButGroupA = groupA.invert()
- Combine groups with
- Improved Collision Simulation
- New ECS based
CollisionSystemandMotionSystem - Rigid body's can now sleep for improved performance
- Multiple contacts now supported which improves stability
- Iterative solver for improved stability
- New ECS based
- Added
ColliderComponentto hold individualColliderimplementations likeCircle,Box, orCompositeColliderActor.collider.get()will get the current colliderActor.collider.set(someCollider)allows you to set a specific collider
- New
CompositeCollidertype to combine multiple colliders together into one for an entity- Composite colliders flatten into their individual colliders in the collision system
- Composite collider keeps it's internal colliders in a DynamicTree for fast
.collidechecks
- New
TransformComponentto encapsulate Entity transform, that is to say position, rotation, and scale - New
MotionComponentto encapsulate Entity transform values changing over time like velocity and acceleration - Added multi-line support to
Textgraphics (#1866) - Added
TileMaparbitrary graphics support with.addGraphic()(#1862) - Added
TileMaprow and column accessorsgetRows()andgetColumns()(#1859) - Added the ability to store arbitrary data in
TileMapcells withCell.data.set('key', 'value')andCell.data.get('key')(#1861) - Actions
moveTo(),moveBy(),easeTo(),scaleTo(), andscaleBy()now have vector overloads Animation.fromSpriteSheetwill now log a warning if an index into theSpriteSheetis invalid (#1856)new ImageSource()will now log a warning if an image type isn't fully supported. (#1855)Timer.start()to explicitly start timers, andTimer.stop()to stop timers and "rewind" them.Timer.timeToNextActionwill return the milliseconds until the next action callbackTimer.timeElapsedTowardNextActionwill return the milliseconds counted towards the next action callbackBoundingBoxnow has a method for detecting zero dimensions in width or heighthasZeroDimensions()BoundingBox's can now bytransform'd by aMatrix- Added
new Entity(components: Component[])constructor overload to create entities with components quickly. - Added
Entity.get(type: ComponentType)to get strongly typed components if they exist on the entity. - Added
Entity.has(type: ComponentType)overload to check if an entity has a component of that type. - Added
Entity.hasTag(tag: string),Entity.addTag(tag: string), andEntity.removeTag(tag: string, force: boolean).- Tag
offscreenis now added to entities that are offscreen
- Tag
- Added
Entity.componentAdded$andEntity.componentRemoved$for observing component changes on an entity. - For child/parent entities:
- Added
Entity.addChild(entity: Entity),Entity.removeChild(entity: Entity),Entity.removeAllChildren()for managing child entities - Added
Entity.addTemplate(templateEntity: Entity)for adding template entities or "prefab". - Added
Entity.parentreadonly accessor to the parent (if exists), andEntity.unparent()to unparent an entity. - Added
Entity.getAncestors()is a sorted list of parents starting with the topmost parent. - Added
Entity.childrenreadonly accessor to the list of children.
- Added
- Add the ability to press enter to start the game after loaded
- Add Excalibur Feature Flag implementation for releasing experimental or preview features (#1673)
- Color now can parse RGB/A string using Color.fromRGBString('rgb(255, 255, 255)') or Color.fromRGBString('rgb(255, 255, 255, 1)')
DisplayMode.FitScreenwill now scale the game to fit the available space, preserving theaspectRatio. (#1733)SpriteSheet.spacingnow accepts a structure{ top: number, left: number, margin: number }for custom spacing dimensions (#1788)SpriteSheet.ctornow has an overload that acceptsspacingfor consistency although the object constructor is recommended (#1788)- Add
SpriteSheet.getSpacingDimensions()method to retrieve calculated spacing dimensions (#1788) - Add
KeyEvent.value?: stringwhich is the key value (or "typed" value) that the browser detected. For example, holding Shift and pressing 9 will have a value of(which is the typed character. - Add
KeyEvent.originalEvent?: KeyboardEventwhich exposes the raw keyboard event handled from the browser.
Changed
Gifnow supports new graphics componentAlgebra.tsrefactored into separate files inMath/- Engine/Scene refactored to make use of the new ECS world which simplifies their logic
TileMapnow uses the built inCollidercomponent instead of custom collision code.- Updates the Excalibur ECS implementation for ease of use and Excalibur draw system integration
- Adds "ex." namespace to built in component types like "ex.transform"
- Adds
ex.Worldto encapsulate all things ECS - Adds
ex.CanvasDrawSystemto handle all HTML Canvas 2D drawing via ECS - Updates
ex.Actorto use newex.TransformComponentandex.CanvasDrawComponent
Deprecated
Timer.unpause()has be deprecated in favor ofTimer.resume()(#1864)- Removed UIActor Stub in favor of ScreenElement (#1656)
ex.SortedListas deprecatedex.Promiseis marked deprecated (#994)ex.DisplayMode.PositionCSS can accomplish this task better than Excalibur (#1733)
Removed
Fixed
- Fixed allow
ex.ColliderComponentto not have a collider - Fixed issue where collision events were not being forwarded from individual colliders in a
ex.CompositeCollider - Fixed issue where
ex.CompositeCollider's individual colliders were erroneously generating pairs - Fixed issue where
GraphicsOptionswidth/heightcould not be used to define aex.Spritewith equivalentsourceViewanddestSize(#1863) - Fixed issue where
ex.Scene.onActivate/onDeactivatewere called with the wrong arguments (#1850) - Fixed issue where no width/height argmunents to engine throws an error
- Fixed issue where zero dimension image draws on the ExcaliburGraphicsContext throw an error
- Fixed issue where the first scene onInitialize fires at Engine contructor time and before the "play button" clicked (#1900)
- Fixed issue where the "play button" click was being interpreted as an input event excalibur needed to handle (#1854)
- Fixed issue where pointer events were not firing at the ex.Engine.input.pointers level (#1439)
- Fixed issue where pointer events propagate in an unexpected order, now they go from high z-index to low z-index (#1922)
- Fixed issue with Raster padding which caused images to grow over time (#1897)
- Fixed N+1 repeat/repeatForever bug (#1891)
- Fixed repeat/repeatForever issue with
rotateTo(#635) - Entity update lifecycle is now called correctly
- Fixed GraphicsSystem
enterviewportandexitviewportevent - Fixed DOM element leak when restarting games, play button elements piled up in the DOM.
- Fixed issues with
ex.Spritenot rotating/scaling correctly around the anchor (Related to TileMap plugin updates excaliburjs/excalibur-tiled#4, excaliburjs/excalibur-tiled#23, excaliburjs/excalibur-tiled#108)- Optionally specify whether to draw around the anchor or not
drawAroundAnchor
- Optionally specify whether to draw around the anchor or not
- Fixed in the browser "FullScreen" api, coordinates are now correctly mapped from page space to world space (#1734)
- Fix audio decoding bug introduced in #1707
- Fixed issue with promise resolve on double resource load (#1434)
- Fixed Firefox bug where scaled graphics with anti-aliasing turned off are not pixelated (#1676)
- Fixed z-index regression where actors did not respect z-index (#1678)
- Fixed Animation flicker bug when switching to an animation (#1636)
- Fixed
ex.Actor.easeToactions, they now use velocity to move Actors (#1638) - Fixed
Sceneconstructor signature to make theEngineargument optional (#1363) - Fixed
anchorproperly of single shapeActor#1535 - Fixed Safari bug where
Soundresources would fail to load (#1848)
