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.rx
has been renamed toex.Actor.angularVelocity
-
Rename
ex.Edge
toex.EdgeCollider
andex.ConvexPolygon
toex.PolygonCollider
to avoid confusion and maintian consistency -
ex.Label
constructor now only takes the option bag constructor and the font properties have been replaced withex.Font
const label = new ex.Label({ text: 'My Text', x: 100, y: 100, font: new ex.Font({ family: 'Consolas', size: 32 }) });
-
ex.Physics.debug
properties 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 -
PerlinNoise
has been removed from the core repo will now be offered as a plugin -
Legacy drawing implementations are moved behind
ex.LegacyDrawing
new Graphics implemenations ofSprite
,SpriteSheet
,Animation
are 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.Box
collision resolution strategy toArcade
-
Renames
CollisionResolutionStrategy.RigidBody
collision resolution strategy toRealistic
-
Collider
is now a first class type and encapsulates whatShape
used to be.Collider
is no longer a member of theBody
-
CollisionType
andCollisionGroup
are now a member of theBody
component, 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.complete
is 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.components
as a way to access, add, and remove components -
ex.Camera.z
has been renamed to propertyex.Camera.zoom
which 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
TileSprite
type 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 = value
has been replaced byengine.showDebug(value)
andengine.toggleDebug()
(#1655) -
UIActor
Class instances need to be replaced toScreenElement
(This Class it's marked as Obsolete) (#1656) -
Switch to browser based promise, the Excalibur implementation
ex.Promise
is marked deprecated (#994) -
DisplayMode
's have changed (#1733) & (#1928):DisplayMode.FitContainer
fits the screen to the available width/height in the canvas parent element, while maintaining aspect ratio and resolutionDisplayMode.FillContainer
update the resolution and viewport dyanmically to fill the available space in the canvas parent element, DOES NOT preserveaspectRatio
DisplayMode.FitScreen
fits the screen to the available browser window space, while maintaining aspect ratio and resolutionDisplayMode.FillScreen
now does whatDisplayMode.FullScreen
used to do, the resolution and viewport dynamically adjust to fill the available space in the window, DOES NOT preserveaspectRatio
(#1733)DisplayMode.FullScreen
is now removed, useScreen.goFullScreen()
.
-
SpriteSheet
now 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
,sprites
andspacing
. -
Engine.pointerScope
now defaults to a more expectedex.Input.PointerScope.Canvas
instead ofex.Input.PointerScope.Document
which can cause frustrating bugs if building an HTML app with Excalibur
Added
- New property
center
toScreen
to 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 withrows
andcolumns
optionally specified, if not there is always 1 row, andsprites.length
columns
new Actor({radius: 10})
can now take a radius parameter to help create circular actors- The
ExcaliburGraphicsContext
now supports drawing debug text Entity
may also now optionally have aname
, this is useful for finding entities by name or when displaying in debug mode.- New
DebugSystem
ECS system will show debug drawing output for things toggled on/off in theengine.debug
section, 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
CollisionGroup
to 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
CollisionSystem
andMotionSystem
- 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
ColliderComponent
to hold individualCollider
implementations likeCircle
,Box
, orCompositeCollider
Actor.collider.get()
will get the current colliderActor.collider.set(someCollider)
allows you to set a specific collider
- New
CompositeCollider
type 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
.collide
checks
- New
TransformComponent
to encapsulate Entity transform, that is to say position, rotation, and scale - New
MotionComponent
to encapsulate Entity transform values changing over time like velocity and acceleration - Added multi-line support to
Text
graphics (#1866) - Added
TileMap
arbitrary graphics support with.addGraphic()
(#1862) - Added
TileMap
row and column accessorsgetRows()
andgetColumns()
(#1859) - Added the ability to store arbitrary data in
TileMap
cells withCell.data.set('key', 'value')
andCell.data.get('key')
(#1861) - Actions
moveTo()
,moveBy()
,easeTo()
,scaleTo()
, andscaleBy()
now have vector overloads Animation.fromSpriteSheet
will now log a warning if an index into theSpriteSheet
is 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.timeToNextAction
will return the milliseconds until the next action callbackTimer.timeElapsedTowardNextAction
will return the milliseconds counted towards the next action callbackBoundingBox
now 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
offscreen
is 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.parent
readonly 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.children
readonly 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.FitScreen
will now scale the game to fit the available space, preserving theaspectRatio
. (#1733)SpriteSheet.spacing
now accepts a structure{ top: number, left: number, margin: number }
for custom spacing dimensions (#1788)SpriteSheet.ctor
now has an overload that acceptsspacing
for consistency although the object constructor is recommended (#1788)- Add
SpriteSheet.getSpacingDimensions()
method to retrieve calculated spacing dimensions (#1788) - Add
KeyEvent.value?: string
which 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?: KeyboardEvent
which exposes the raw keyboard event handled from the browser.
Changed
Gif
now supports new graphics componentAlgebra.ts
refactored into separate files inMath/
- Engine/Scene refactored to make use of the new ECS world which simplifies their logic
TileMap
now uses the built inCollider
component 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.World
to encapsulate all things ECS - Adds
ex.CanvasDrawSystem
to handle all HTML Canvas 2D drawing via ECS - Updates
ex.Actor
to use newex.TransformComponent
andex.CanvasDrawComponent
Deprecated
Timer.unpause()
has be deprecated in favor ofTimer.resume()
(#1864)- Removed UIActor Stub in favor of ScreenElement (#1656)
ex.SortedList
as deprecatedex.Promise
is marked deprecated (#994)ex.DisplayMode.Position
CSS can accomplish this task better than Excalibur (#1733)
Removed
Fixed
- Fixed allow
ex.ColliderComponent
to 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
GraphicsOptions
width/height
could not be used to define aex.Sprite
with equivalentsourceView
anddestSize
(#1863) - Fixed issue where
ex.Scene.onActivate/onDeactivate
were 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
enterviewport
andexitviewport
event - Fixed DOM element leak when restarting games, play button elements piled up in the DOM.
- Fixed issues with
ex.Sprite
not 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.easeTo
actions, they now use velocity to move Actors (#1638) - Fixed
Scene
constructor signature to make theEngine
argument optional (#1363) - Fixed
anchor
properly of single shapeActor
#1535 - Fixed Safari bug where
Sound
resources would fail to load (#1848)