excalibur 0.25.0 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nvmrc +1 -1
- package/CHANGELOG.md +49 -9
- package/LICENSE.md +1 -1
- package/README.md +8 -12
- package/build/dist/Actions/Action/Blink.d.ts +3 -3
- package/build/dist/Actions/Action/Delay.d.ts +1 -5
- package/build/dist/Actions/Action/Die.d.ts +3 -5
- package/build/dist/Actions/Action/EaseTo.d.ts +4 -2
- package/build/dist/Actions/Action/Fade.d.ts +3 -3
- package/build/dist/Actions/Action/Follow.d.ts +6 -4
- package/build/dist/Actions/Action/Meet.d.ts +6 -4
- package/build/dist/Actions/Action/MoveBy.d.ts +6 -4
- package/build/dist/Actions/Action/MoveTo.d.ts +6 -4
- package/build/dist/Actions/Action/Repeat.d.ts +2 -2
- package/build/dist/Actions/Action/RepeatForever.d.ts +2 -2
- package/build/dist/Actions/Action/RotateBy.d.ts +4 -3
- package/build/dist/Actions/Action/RotateTo.d.ts +4 -3
- package/build/dist/Actions/Action/ScaleBy.d.ts +4 -3
- package/build/dist/Actions/Action/ScaleTo.d.ts +4 -3
- package/build/dist/Actions/Action.d.ts +2 -2
- package/build/dist/Actions/ActionContext.d.ts +16 -10
- package/build/dist/Actions/ActionQueue.d.ts +3 -3
- package/build/dist/Actions/ActionsComponent.d.ts +236 -0
- package/build/dist/Actions/ActionsSystem.d.ts +9 -0
- package/build/dist/Actions/Index.d.ts +2 -0
- package/build/dist/Actor.d.ts +10 -8
- package/build/dist/Engine.d.ts +6 -1
- package/build/dist/EntityComponentSystem/EntityManager.d.ts +1 -0
- package/build/dist/Graphics/Animation.d.ts +64 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.d.ts +1 -1
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +6 -0
- package/build/dist/Graphics/GraphicsComponent.d.ts +2 -0
- package/build/dist/Loader.css +1 -0
- package/build/dist/Loader.d.ts +1 -0
- package/build/dist/Screen.d.ts +3 -0
- package/build/dist/excalibur.js +14369 -13942
- package/build/dist/excalibur.js.map +1 -1
- package/build/dist/excalibur.min.js +1 -1
- package/build/dist/excalibur.min.js.LICENSE.txt +1 -1
- package/build/dist/excalibur.min.js.map +1 -1
- package/build/esm/Actions/Action/Blink.d.ts +17 -0
- package/build/esm/Actions/Action/CallMethod.d.ts +10 -0
- package/build/esm/Actions/Action/Delay.d.ts +12 -0
- package/build/esm/Actions/Action/Die.d.ts +11 -0
- package/build/esm/Actions/Action/EaseTo.d.ts +21 -0
- package/build/esm/Actions/Action/Fade.d.ts +17 -0
- package/build/esm/Actions/Action/Follow.d.ts +23 -0
- package/build/esm/Actions/Action/Meet.d.ts +23 -0
- package/build/esm/Actions/Action/MoveBy.d.ts +22 -0
- package/build/esm/Actions/Action/MoveTo.d.ts +21 -0
- package/build/esm/Actions/Action/Repeat.d.ts +16 -0
- package/build/esm/Actions/Action/RepeatForever.d.ts +20 -0
- package/build/esm/Actions/Action/RotateBy.d.ts +27 -0
- package/build/esm/Actions/Action/RotateTo.d.ts +26 -0
- package/build/esm/Actions/Action/ScaleBy.d.ts +24 -0
- package/build/esm/Actions/Action/ScaleTo.d.ts +23 -0
- package/build/esm/Actions/Action.d.ts +10 -0
- package/build/esm/Actions/ActionContext.d.ts +219 -0
- package/build/esm/Actions/ActionQueue.d.ts +56 -0
- package/build/esm/Actions/Actionable.d.ts +4 -0
- package/build/esm/Actions/ActionsComponent.d.ts +236 -0
- package/build/esm/Actions/ActionsSystem.d.ts +9 -0
- package/build/{dist/Actions/Index.js → esm/Actions/Index.d.ts} +2 -1
- package/build/{dist/Actions/RotationType.js → esm/Actions/RotationType.d.ts} +6 -8
- package/build/esm/Actor.d.ts +727 -0
- package/build/esm/Camera.d.ts +360 -0
- package/build/{dist/Class.js → esm/Class.d.ts} +12 -17
- package/build/esm/Collision/BodyComponent.d.ts +208 -0
- package/build/esm/Collision/BoundingBox.d.ts +109 -0
- package/build/esm/Collision/ColliderComponent.d.ts +98 -0
- package/build/esm/Collision/Colliders/CircleCollider.d.ts +92 -0
- package/build/esm/Collision/Colliders/ClosestLineJumpTable.d.ts +23 -0
- package/build/esm/Collision/Colliders/Collider.d.ts +94 -0
- package/build/esm/Collision/Colliders/CollisionJumpTable.d.ts +14 -0
- package/build/esm/Collision/Colliders/CompositeCollider.d.ts +38 -0
- package/build/esm/Collision/Colliders/EdgeCollider.d.ts +112 -0
- package/build/esm/Collision/Colliders/PolygonCollider.d.ts +138 -0
- package/build/esm/Collision/Colliders/SeparatingAxis.d.ts +46 -0
- package/build/esm/Collision/Colliders/Shape.d.ts +54 -0
- package/build/esm/Collision/CollisionSystem.d.ts +26 -0
- package/build/{dist/Collision/CollisionType.js → esm/Collision/CollisionType.d.ts} +6 -8
- package/build/esm/Collision/Detection/CollisionContact.d.ts +53 -0
- package/build/esm/Collision/Detection/CollisionProcessor.d.ts +28 -0
- package/build/esm/Collision/Detection/DynamicTree.d.ts +85 -0
- package/build/esm/Collision/Detection/DynamicTreeCollisionProcessor.d.ts +40 -0
- package/build/esm/Collision/Detection/Pair.d.ts +31 -0
- package/build/{dist/Collision/Group/CollisionGroup.js → esm/Collision/Group/CollisionGroup.d.ts} +17 -36
- package/build/esm/Collision/Group/CollisionGroupManager.d.ts +30 -0
- package/build/{dist/Collision/Index.js → esm/Collision/Index.d.ts} +0 -1
- package/build/esm/Collision/Integrator.d.ts +6 -0
- package/build/esm/Collision/MotionSystem.d.ts +11 -0
- package/build/esm/Collision/Physics.d.ts +133 -0
- package/build/esm/Collision/Side.d.ts +21 -0
- package/build/esm/Collision/Solver/ArcadeSolver.d.ts +15 -0
- package/build/esm/Collision/Solver/ContactConstraintPoint.d.ts +43 -0
- package/build/esm/Collision/Solver/RealisticSolver.d.ts +21 -0
- package/build/esm/Collision/Solver/Solver.d.ts +50 -0
- package/build/esm/Color.d.ts +244 -0
- package/build/esm/Configurable.d.ts +9 -0
- package/build/esm/Debug/Debug.d.ts +327 -0
- package/build/esm/Debug/DebugFlags.d.ts +11 -0
- package/build/esm/Debug/DebugSystem.d.ts +29 -0
- package/build/{dist/Debug/index.js → esm/Debug/index.d.ts} +0 -1
- package/build/esm/Deprecated.d.ts +0 -0
- package/build/esm/Drawing/Animation.d.ts +196 -0
- package/build/esm/Drawing/CanvasDrawComponent.d.ts +10 -0
- package/build/esm/Drawing/CanvasDrawingSystem.d.ts +23 -0
- package/build/esm/Drawing/Index.d.ts +9 -0
- package/build/esm/Drawing/Polygon.d.ts +74 -0
- package/build/esm/Drawing/Sprite.d.ts +159 -0
- package/build/esm/Drawing/SpriteEffects.d.ts +120 -0
- package/build/esm/Drawing/SpriteSheet.d.ts +184 -0
- package/build/esm/Drawing/Texture.d.ts +44 -0
- package/build/esm/Engine.d.ts +586 -0
- package/build/esm/EntityComponentSystem/Component.d.ts +69 -0
- package/build/esm/EntityComponentSystem/Components/MotionComponent.d.ts +55 -0
- package/build/esm/EntityComponentSystem/Components/TransformComponent.d.ts +103 -0
- package/build/esm/EntityComponentSystem/Entity.d.ts +247 -0
- package/build/esm/EntityComponentSystem/EntityManager.d.ts +35 -0
- package/build/esm/EntityComponentSystem/Query.d.ts +51 -0
- package/build/esm/EntityComponentSystem/QueryManager.d.ts +48 -0
- package/build/esm/EntityComponentSystem/System.d.ts +107 -0
- package/build/esm/EntityComponentSystem/SystemManager.d.ts +45 -0
- package/build/esm/EntityComponentSystem/Util.d.ts +1 -0
- package/build/esm/EntityComponentSystem/World.d.ts +45 -0
- package/build/{dist/EntityComponentSystem/index.js → esm/EntityComponentSystem/index.d.ts} +0 -1
- package/build/esm/EventDispatcher.d.ts +51 -0
- package/build/esm/Events/MediaEvents.d.ts +47 -0
- package/build/esm/Events.d.ts +475 -0
- package/build/esm/Flags.d.ts +62 -0
- package/build/esm/Graphics/Animation.d.ts +189 -0
- package/build/esm/Graphics/Canvas.d.ts +24 -0
- package/build/esm/Graphics/Circle.d.ts +15 -0
- package/build/esm/Graphics/Context/ExcaliburGraphicsContext.d.ts +155 -0
- package/build/esm/Graphics/Context/ExcaliburGraphicsContext2DCanvas.d.ts +87 -0
- package/build/esm/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +111 -0
- package/build/esm/Graphics/Context/batch.d.ts +11 -0
- package/build/esm/Graphics/Context/debug-text.d.ts +24 -0
- package/build/esm/Graphics/Context/draw-image-command.d.ts +47 -0
- package/build/esm/Graphics/Context/image-renderer.d.ts +39 -0
- package/build/esm/Graphics/Context/line-renderer.d.ts +22 -0
- package/build/esm/Graphics/Context/point-renderer.d.ts +22 -0
- package/build/esm/Graphics/Context/renderer.d.ts +66 -0
- package/build/esm/Graphics/Context/shader.d.ts +81 -0
- package/build/esm/Graphics/Context/state-stack.d.ts +10 -0
- package/build/esm/Graphics/Context/texture-loader.d.ts +33 -0
- package/build/esm/Graphics/Context/transform-stack.d.ts +12 -0
- package/build/esm/Graphics/Context/webgl-util.d.ts +12 -0
- package/build/esm/Graphics/Font.d.ts +57 -0
- package/build/{dist/Graphics/FontCommon.js → esm/Graphics/FontCommon.d.ts} +54 -37
- package/build/esm/Graphics/Graphic.d.ts +129 -0
- package/build/esm/Graphics/GraphicsComponent.d.ts +224 -0
- package/build/esm/Graphics/GraphicsDiagnostics.d.ts +5 -0
- package/build/esm/Graphics/GraphicsGroup.d.ts +24 -0
- package/build/esm/Graphics/GraphicsSystem.d.ts +35 -0
- package/build/esm/Graphics/ImageSource.d.ts +53 -0
- package/build/esm/Graphics/Polygon.d.ts +17 -0
- package/build/esm/Graphics/Raster.d.ts +105 -0
- package/build/esm/Graphics/Rectangle.d.ts +13 -0
- package/build/esm/Graphics/Sprite.d.ts +59 -0
- package/build/esm/Graphics/SpriteFont.d.ts +53 -0
- package/build/esm/Graphics/SpriteSheet.d.ts +137 -0
- package/build/esm/Graphics/Text.d.ts +29 -0
- package/build/{dist/Graphics/index.js → esm/Graphics/index.d.ts} +0 -4
- package/build/esm/Id.d.ts +8 -0
- package/build/esm/Input/CapturePointerConfig.d.ts +13 -0
- package/build/esm/Input/EngineInput.d.ts +8 -0
- package/build/esm/Input/Gamepad.d.ts +227 -0
- package/build/{dist/Input/Index.js → esm/Input/Index.d.ts} +0 -1
- package/build/esm/Input/Keyboard.d.ts +187 -0
- package/build/esm/Input/Pointer.d.ts +134 -0
- package/build/esm/Input/PointerEvents.d.ts +170 -0
- package/build/esm/Input/Pointers.d.ts +78 -0
- package/build/esm/Interfaces/Audio.d.ts +29 -0
- package/build/esm/Interfaces/AudioImplementation.d.ts +25 -0
- package/build/esm/Interfaces/Clonable.d.ts +3 -0
- package/build/esm/Interfaces/Drawable.d.ts +97 -0
- package/build/esm/Interfaces/Evented.d.ts +31 -0
- package/build/{dist/Interfaces/Index.js → esm/Interfaces/Index.d.ts} +0 -1
- package/build/esm/Interfaces/LifecycleEvents.d.ts +167 -0
- package/build/esm/Interfaces/Loadable.d.ts +18 -0
- package/build/esm/Interfaces/PointerEventHandlers.d.ts +40 -0
- package/build/esm/Interfaces/Trait.d.ts +9 -0
- package/build/esm/Label.d.ts +146 -0
- package/build/esm/Loader.d.ts +174 -0
- package/build/{dist/Math/Index.js → esm/Math/Index.d.ts} +0 -1
- package/build/esm/Math/Random.d.ts +125 -0
- package/build/esm/Math/global-coordinates.d.ts +10 -0
- package/build/esm/Math/line.d.ts +95 -0
- package/build/esm/Math/matrix.d.ts +110 -0
- package/build/esm/Math/projection.d.ts +10 -0
- package/build/esm/Math/ray.d.ts +25 -0
- package/build/esm/Math/vector-view.d.ts +18 -0
- package/build/esm/Math/vector.d.ts +201 -0
- package/build/esm/Particles.d.ts +244 -0
- package/build/esm/Polyfill.d.ts +6 -0
- package/build/esm/PostProcessing/ColorBlindCorrector.d.ts +28 -0
- package/build/{dist/PostProcessing/Index.js → esm/PostProcessing/Index.d.ts} +0 -1
- package/build/esm/PostProcessing/PostProcessor.d.ts +6 -0
- package/build/esm/Promises.d.ts +87 -0
- package/build/esm/Resources/Gif.d.ts +117 -0
- package/build/{dist/Resources/Index.js → esm/Resources/Index.d.ts} +0 -1
- package/build/esm/Resources/Resource.d.ts +31 -0
- package/build/esm/Resources/Sound/AudioContext.d.ts +7 -0
- package/build/{dist/Resources/Sound/Index.js → esm/Resources/Sound/Index.d.ts} +0 -1
- package/build/esm/Resources/Sound/Sound.d.ts +79 -0
- package/build/esm/Resources/Sound/WebAudioInstance.d.ts +45 -0
- package/build/esm/Scene.d.ts +301 -0
- package/build/esm/Screen.d.ts +285 -0
- package/build/esm/ScreenElement.d.ts +13 -0
- package/build/esm/TileMap.d.ts +222 -0
- package/build/esm/Timer.d.ts +93 -0
- package/build/esm/Traits/CapturePointer.d.ts +10 -0
- package/build/{dist/Traits/Index.js → esm/Traits/Index.d.ts} +0 -1
- package/build/esm/Traits/OffscreenCulling.d.ts +11 -0
- package/build/esm/Trigger.d.ts +48 -0
- package/build/esm/Util/Actors.d.ts +12 -0
- package/build/esm/Util/Browser.d.ts +28 -0
- package/build/esm/Util/CullingBox.d.ts +23 -0
- package/build/esm/Util/Decorators.d.ts +15 -0
- package/build/esm/Util/Detector.d.ts +40 -0
- package/build/esm/Util/DrawUtil.d.ts +69 -0
- package/build/esm/Util/EasingFunctions.d.ts +59 -0
- package/build/{dist/Util/Index.js → esm/Util/Index.d.ts} +0 -1
- package/build/esm/Util/Log.d.ts +109 -0
- package/build/esm/Util/Observable.d.ts +55 -0
- package/build/esm/Util/Pool.d.ts +44 -0
- package/build/esm/Util/SortedList.d.ts +52 -0
- package/build/esm/Util/Sound.d.ts +4 -0
- package/build/esm/Util/Util.d.ts +196 -0
- package/build/esm/Util/Watch.d.ts +8 -0
- package/build/esm/Util/WebAudio.d.ts +15 -0
- package/build/esm/excalibur.d.ts +2 -0
- package/build/esm/excalibur.js +28874 -0
- package/build/esm/excalibur.js.map +1 -0
- package/build/esm/excalibur.min.js +3 -0
- package/build/esm/excalibur.min.js.LICENSE.txt +7 -0
- package/build/esm/excalibur.min.js.map +1 -0
- package/build/{dist/index.js → esm/index.d.ts} +4 -18
- package/package.json +31 -25
- package/wallaby.js +2 -0
- package/build/dist/Actions/Action/Blink.js +0 -45
- package/build/dist/Actions/Action/Blink.js.map +0 -1
- package/build/dist/Actions/Action/CallMethod.js +0 -21
- package/build/dist/Actions/Action/CallMethod.js.map +0 -1
- package/build/dist/Actions/Action/Delay.js +0 -28
- package/build/dist/Actions/Action/Delay.js.map +0 -1
- package/build/dist/Actions/Action/Die.js +0 -21
- package/build/dist/Actions/Action/Die.js.map +0 -1
- package/build/dist/Actions/Action/EaseTo.js +0 -66
- package/build/dist/Actions/Action/EaseTo.js.map +0 -1
- package/build/dist/Actions/Action/Fade.js +0 -42
- package/build/dist/Actions/Action/Fade.js.map +0 -1
- package/build/dist/Actions/Action/Follow.js +0 -51
- package/build/dist/Actions/Action/Follow.js.map +0 -1
- package/build/dist/Actions/Action/Meet.js +0 -48
- package/build/dist/Actions/Action/Meet.js.map +0 -1
- package/build/dist/Actions/Action/MoveBy.js +0 -42
- package/build/dist/Actions/Action/MoveBy.js.map +0 -1
- package/build/dist/Actions/Action/MoveTo.js +0 -35
- package/build/dist/Actions/Action/MoveTo.js.map +0 -1
- package/build/dist/Actions/Action/Repeat.js +0 -31
- package/build/dist/Actions/Action/Repeat.js.map +0 -1
- package/build/dist/Actions/Action/RepeatForever.js +0 -37
- package/build/dist/Actions/Action/RepeatForever.js.map +0 -1
- package/build/dist/Actions/Action/RotateBy.js +0 -88
- package/build/dist/Actions/Action/RotateBy.js.map +0 -1
- package/build/dist/Actions/Action/RotateTo.js +0 -87
- package/build/dist/Actions/Action/RotateTo.js.map +0 -1
- package/build/dist/Actions/Action/ScaleBy.js +0 -47
- package/build/dist/Actions/Action/ScaleBy.js.map +0 -1
- package/build/dist/Actions/Action/ScaleTo.js +0 -58
- package/build/dist/Actions/Action/ScaleTo.js.map +0 -1
- package/build/dist/Actions/Action.js +0 -2
- package/build/dist/Actions/Action.js.map +0 -1
- package/build/dist/Actions/ActionContext.js +0 -297
- package/build/dist/Actions/ActionContext.js.map +0 -1
- package/build/dist/Actions/ActionQueue.js +0 -87
- package/build/dist/Actions/ActionQueue.js.map +0 -1
- package/build/dist/Actions/Actionable.js +0 -2
- package/build/dist/Actions/Actionable.js.map +0 -1
- package/build/dist/Actions/Index.js.map +0 -1
- package/build/dist/Actions/RotationType.js.map +0 -1
- package/build/dist/Actor.js +0 -856
- package/build/dist/Actor.js.map +0 -1
- package/build/dist/Camera.js +0 -627
- package/build/dist/Camera.js.map +0 -1
- package/build/dist/Class.js.map +0 -1
- package/build/dist/Collision/BodyComponent.js +0 -347
- package/build/dist/Collision/BodyComponent.js.map +0 -1
- package/build/dist/Collision/BoundingBox.js +0 -355
- package/build/dist/Collision/BoundingBox.js.map +0 -1
- package/build/dist/Collision/ColliderComponent.js +0 -201
- package/build/dist/Collision/ColliderComponent.js.map +0 -1
- package/build/dist/Collision/Colliders/CircleCollider.js +0 -215
- package/build/dist/Collision/Colliders/CircleCollider.js.map +0 -1
- package/build/dist/Collision/Colliders/ClosestLineJumpTable.js +0 -211
- package/build/dist/Collision/Colliders/ClosestLineJumpTable.js.map +0 -1
- package/build/dist/Collision/Colliders/Collider.js +0 -26
- package/build/dist/Collision/Colliders/Collider.js.map +0 -1
- package/build/dist/Collision/Colliders/CollisionJumpTable.js +0 -301
- package/build/dist/Collision/Colliders/CollisionJumpTable.js.map +0 -1
- package/build/dist/Collision/Colliders/CompositeCollider.js +0 -232
- package/build/dist/Collision/Colliders/CompositeCollider.js.map +0 -1
- package/build/dist/Collision/Colliders/EdgeCollider.js +0 -253
- package/build/dist/Collision/Colliders/EdgeCollider.js.map +0 -1
- package/build/dist/Collision/Colliders/PolygonCollider.js +0 -389
- package/build/dist/Collision/Colliders/PolygonCollider.js.map +0 -1
- package/build/dist/Collision/Colliders/SeparatingAxis.js +0 -67
- package/build/dist/Collision/Colliders/SeparatingAxis.js.map +0 -1
- package/build/dist/Collision/Colliders/Shape.js +0 -102
- package/build/dist/Collision/Colliders/Shape.js.map +0 -1
- package/build/dist/Collision/CollisionSystem.js +0 -116
- package/build/dist/Collision/CollisionSystem.js.map +0 -1
- package/build/dist/Collision/CollisionType.js.map +0 -1
- package/build/dist/Collision/Detection/CollisionContact.js +0 -46
- package/build/dist/Collision/Detection/CollisionContact.js.map +0 -1
- package/build/dist/Collision/Detection/CollisionProcessor.js +0 -2
- package/build/dist/Collision/Detection/CollisionProcessor.js.map +0 -1
- package/build/dist/Collision/Detection/DynamicTree.js +0 -442
- package/build/dist/Collision/Detection/DynamicTree.js.map +0 -1
- package/build/dist/Collision/Detection/DynamicTreeCollisionProcessor.js +0 -228
- package/build/dist/Collision/Detection/DynamicTreeCollisionProcessor.js.map +0 -1
- package/build/dist/Collision/Detection/Pair.js +0 -74
- package/build/dist/Collision/Detection/Pair.js.map +0 -1
- package/build/dist/Collision/Group/CollisionGroup.js.map +0 -1
- package/build/dist/Collision/Group/CollisionGroupManager.js +0 -52
- package/build/dist/Collision/Group/CollisionGroupManager.js.map +0 -1
- package/build/dist/Collision/Index.js.map +0 -1
- package/build/dist/Collision/Integrator.js +0 -11
- package/build/dist/Collision/Integrator.js.map +0 -1
- package/build/dist/Collision/MotionSystem.js +0 -38
- package/build/dist/Collision/MotionSystem.js.map +0 -1
- package/build/dist/Collision/Physics.js +0 -163
- package/build/dist/Collision/Physics.js.map +0 -1
- package/build/dist/Collision/Side.js +0 -51
- package/build/dist/Collision/Side.js.map +0 -1
- package/build/dist/Collision/Solver/ArcadeSolver.js +0 -96
- package/build/dist/Collision/Solver/ArcadeSolver.js.map +0 -1
- package/build/dist/Collision/Solver/ContactConstraintPoint.js +0 -83
- package/build/dist/Collision/Solver/ContactConstraintPoint.js.map +0 -1
- package/build/dist/Collision/Solver/RealisticSolver.js +0 -248
- package/build/dist/Collision/Solver/RealisticSolver.js.map +0 -1
- package/build/dist/Collision/Solver/Solver.js +0 -37
- package/build/dist/Collision/Solver/Solver.js.map +0 -1
- package/build/dist/Color.js +0 -461
- package/build/dist/Color.js.map +0 -1
- package/build/dist/Configurable.js +0 -32
- package/build/dist/Configurable.js.map +0 -1
- package/build/dist/Debug/Debug.js +0 -339
- package/build/dist/Debug/Debug.js.map +0 -1
- package/build/dist/Debug/DebugFlags.js +0 -13
- package/build/dist/Debug/DebugFlags.js.map +0 -1
- package/build/dist/Debug/DebugSystem.js +0 -242
- package/build/dist/Debug/DebugSystem.js.map +0 -1
- package/build/dist/Debug/index.js.map +0 -1
- package/build/dist/Deprecated.js +0 -2
- package/build/dist/Deprecated.js.map +0 -1
- package/build/dist/Drawing/Animation.js +0 -285
- package/build/dist/Drawing/Animation.js.map +0 -1
- package/build/dist/Drawing/CanvasDrawComponent.js +0 -16
- package/build/dist/Drawing/CanvasDrawComponent.js.map +0 -1
- package/build/dist/Drawing/CanvasDrawingSystem.js +0 -95
- package/build/dist/Drawing/CanvasDrawingSystem.js.map +0 -1
- package/build/dist/Drawing/Index.js +0 -10
- package/build/dist/Drawing/Index.js.map +0 -1
- package/build/dist/Drawing/Polygon.js +0 -129
- package/build/dist/Drawing/Polygon.js.map +0 -1
- package/build/dist/Drawing/Sprite.js +0 -356
- package/build/dist/Drawing/Sprite.js.map +0 -1
- package/build/dist/Drawing/SpriteEffects.js +0 -246
- package/build/dist/Drawing/SpriteEffects.js.map +0 -1
- package/build/dist/Drawing/SpriteSheet.js +0 -413
- package/build/dist/Drawing/SpriteSheet.js.map +0 -1
- package/build/dist/Drawing/Texture.js +0 -80
- package/build/dist/Drawing/Texture.js.map +0 -1
- package/build/dist/Engine.js +0 -871
- package/build/dist/Engine.js.map +0 -1
- package/build/dist/EntityComponentSystem/Component.js +0 -65
- package/build/dist/EntityComponentSystem/Component.js.map +0 -1
- package/build/dist/EntityComponentSystem/Components/MotionComponent.js +0 -33
- package/build/dist/EntityComponentSystem/Components/MotionComponent.js.map +0 -1
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js +0 -249
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js.map +0 -1
- package/build/dist/EntityComponentSystem/Entity.js +0 -452
- package/build/dist/EntityComponentSystem/Entity.js.map +0 -1
- package/build/dist/EntityComponentSystem/EntityManager.js +0 -121
- package/build/dist/EntityComponentSystem/EntityManager.js.map +0 -1
- package/build/dist/EntityComponentSystem/Query.js +0 -91
- package/build/dist/EntityComponentSystem/Query.js.map +0 -1
- package/build/dist/EntityComponentSystem/QueryManager.js +0 -90
- package/build/dist/EntityComponentSystem/QueryManager.js.map +0 -1
- package/build/dist/EntityComponentSystem/System.js +0 -76
- package/build/dist/EntityComponentSystem/System.js.map +0 -1
- package/build/dist/EntityComponentSystem/SystemManager.js +0 -96
- package/build/dist/EntityComponentSystem/SystemManager.js.map +0 -1
- package/build/dist/EntityComponentSystem/Util.js +0 -5
- package/build/dist/EntityComponentSystem/Util.js.map +0 -1
- package/build/dist/EntityComponentSystem/World.js +0 -55
- package/build/dist/EntityComponentSystem/World.js.map +0 -1
- package/build/dist/EntityComponentSystem/index.js.map +0 -1
- package/build/dist/EventDispatcher.js +0 -133
- package/build/dist/EventDispatcher.js.map +0 -1
- package/build/dist/Events/MediaEvents.js +0 -75
- package/build/dist/Events/MediaEvents.js.map +0 -1
- package/build/dist/Events.js +0 -497
- package/build/dist/Events.js.map +0 -1
- package/build/dist/Flags.js +0 -90
- package/build/dist/Flags.js.map +0 -1
- package/build/dist/Graphics/Animation.js +0 -230
- package/build/dist/Graphics/Animation.js.map +0 -1
- package/build/dist/Graphics/Canvas.js +0 -34
- package/build/dist/Graphics/Canvas.js.map +0 -1
- package/build/dist/Graphics/Circle.js +0 -39
- package/build/dist/Graphics/Circle.js.map +0 -1
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js +0 -2
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js.map +0 -1
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js +0 -177
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js.map +0 -1
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js +0 -188
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js.map +0 -1
- package/build/dist/Graphics/Context/batch.js +0 -24
- package/build/dist/Graphics/Context/batch.js.map +0 -1
- package/build/dist/Graphics/Context/debug-text.js +0 -47
- package/build/dist/Graphics/Context/debug-text.js.map +0 -1
- package/build/dist/Graphics/Context/draw-image-command.js +0 -179
- package/build/dist/Graphics/Context/draw-image-command.js.map +0 -1
- package/build/dist/Graphics/Context/image-renderer.js +0 -295
- package/build/dist/Graphics/Context/image-renderer.js.map +0 -1
- package/build/dist/Graphics/Context/line-renderer.js +0 -70
- package/build/dist/Graphics/Context/line-renderer.js.map +0 -1
- package/build/dist/Graphics/Context/point-renderer.js +0 -67
- package/build/dist/Graphics/Context/point-renderer.js.map +0 -1
- package/build/dist/Graphics/Context/renderer.js +0 -75
- package/build/dist/Graphics/Context/renderer.js.map +0 -1
- package/build/dist/Graphics/Context/shader.js +0 -189
- package/build/dist/Graphics/Context/shader.js.map +0 -1
- package/build/dist/Graphics/Context/state-stack.js +0 -27
- package/build/dist/Graphics/Context/state-stack.js.map +0 -1
- package/build/dist/Graphics/Context/texture-loader.js +0 -84
- package/build/dist/Graphics/Context/texture-loader.js.map +0 -1
- package/build/dist/Graphics/Context/transform-stack.js +0 -30
- package/build/dist/Graphics/Context/transform-stack.js.map +0 -1
- package/build/dist/Graphics/Context/webgl-util.js +0 -26
- package/build/dist/Graphics/Context/webgl-util.js.map +0 -1
- package/build/dist/Graphics/Font.js +0 -209
- package/build/dist/Graphics/Font.js.map +0 -1
- package/build/dist/Graphics/FontCommon.js.map +0 -1
- package/build/dist/Graphics/Graphic.js +0 -147
- package/build/dist/Graphics/Graphic.js.map +0 -1
- package/build/dist/Graphics/GraphicsComponent.js +0 -276
- package/build/dist/Graphics/GraphicsComponent.js.map +0 -1
- package/build/dist/Graphics/GraphicsDiagnostics.js +0 -9
- package/build/dist/Graphics/GraphicsDiagnostics.js.map +0 -1
- package/build/dist/Graphics/GraphicsGroup.js +0 -66
- package/build/dist/Graphics/GraphicsGroup.js.map +0 -1
- package/build/dist/Graphics/GraphicsSystem.js +0 -161
- package/build/dist/Graphics/GraphicsSystem.js.map +0 -1
- package/build/dist/Graphics/ImageSource.js +0 -117
- package/build/dist/Graphics/ImageSource.js.map +0 -1
- package/build/dist/Graphics/Polygon.js +0 -51
- package/build/dist/Graphics/Polygon.js.map +0 -1
- package/build/dist/Graphics/Raster.js +0 -209
- package/build/dist/Graphics/Raster.js.map +0 -1
- package/build/dist/Graphics/Rectangle.js +0 -24
- package/build/dist/Graphics/Rectangle.js.map +0 -1
- package/build/dist/Graphics/Sprite.js +0 -81
- package/build/dist/Graphics/Sprite.js.map +0 -1
- package/build/dist/Graphics/SpriteFont.js +0 -116
- package/build/dist/Graphics/SpriteFont.js.map +0 -1
- package/build/dist/Graphics/SpriteSheet.js +0 -116
- package/build/dist/Graphics/SpriteSheet.js.map +0 -1
- package/build/dist/Graphics/Text.js +0 -82
- package/build/dist/Graphics/Text.js.map +0 -1
- package/build/dist/Graphics/index.js.map +0 -1
- package/build/dist/Id.js +0 -8
- package/build/dist/Id.js.map +0 -1
- package/build/dist/Input/CapturePointerConfig.js +0 -5
- package/build/dist/Input/CapturePointerConfig.js.map +0 -1
- package/build/dist/Input/EngineInput.js +0 -2
- package/build/dist/Input/EngineInput.js.map +0 -1
- package/build/dist/Input/Gamepad.js +0 -358
- package/build/dist/Input/Gamepad.js.map +0 -1
- package/build/dist/Input/Index.js.map +0 -1
- package/build/dist/Input/Keyboard.js +0 -267
- package/build/dist/Input/Keyboard.js.map +0 -1
- package/build/dist/Input/Pointer.js +0 -205
- package/build/dist/Input/Pointer.js.map +0 -1
- package/build/dist/Input/PointerEvents.js +0 -309
- package/build/dist/Input/PointerEvents.js.map +0 -1
- package/build/dist/Input/Pointers.js +0 -405
- package/build/dist/Input/Pointers.js.map +0 -1
- package/build/dist/Interfaces/Audio.js +0 -2
- package/build/dist/Interfaces/Audio.js.map +0 -1
- package/build/dist/Interfaces/AudioImplementation.js +0 -11
- package/build/dist/Interfaces/AudioImplementation.js.map +0 -1
- package/build/dist/Interfaces/Clonable.js +0 -2
- package/build/dist/Interfaces/Clonable.js.map +0 -1
- package/build/dist/Interfaces/Drawable.js +0 -2
- package/build/dist/Interfaces/Drawable.js.map +0 -1
- package/build/dist/Interfaces/Evented.js +0 -2
- package/build/dist/Interfaces/Evented.js.map +0 -1
- package/build/dist/Interfaces/Index.js.map +0 -1
- package/build/dist/Interfaces/LifecycleEvents.js +0 -51
- package/build/dist/Interfaces/LifecycleEvents.js.map +0 -1
- package/build/dist/Interfaces/Loadable.js +0 -2
- package/build/dist/Interfaces/Loadable.js.map +0 -1
- package/build/dist/Interfaces/PointerEventHandlers.js +0 -2
- package/build/dist/Interfaces/PointerEventHandlers.js.map +0 -1
- package/build/dist/Interfaces/Trait.js +0 -2
- package/build/dist/Interfaces/Trait.js.map +0 -1
- package/build/dist/Label.js +0 -262
- package/build/dist/Label.js.map +0 -1
- package/build/dist/Loader.js +0 -344
- package/build/dist/Loader.js.map +0 -1
- package/build/dist/Math/Index.js.map +0 -1
- package/build/dist/Math/Random.js +0 -239
- package/build/dist/Math/Random.js.map +0 -1
- package/build/dist/Math/global-coordinates.js +0 -30
- package/build/dist/Math/global-coordinates.js.map +0 -1
- package/build/dist/Math/line.js +0 -194
- package/build/dist/Math/line.js.map +0 -1
- package/build/dist/Math/matrix.js +0 -425
- package/build/dist/Math/matrix.js.map +0 -1
- package/build/dist/Math/projection.js +0 -24
- package/build/dist/Math/projection.js.map +0 -1
- package/build/dist/Math/ray.js +0 -52
- package/build/dist/Math/ray.js.map +0 -1
- package/build/dist/Math/vector-view.js +0 -25
- package/build/dist/Math/vector-view.js.map +0 -1
- package/build/dist/Math/vector.js +0 -326
- package/build/dist/Math/vector.js.map +0 -1
- package/build/dist/Particles.js +0 -436
- package/build/dist/Particles.js.map +0 -1
- package/build/dist/Polyfill.js +0 -56
- package/build/dist/Polyfill.js.map +0 -1
- package/build/dist/PostProcessing/ColorBlindCorrector.js +0 -193
- package/build/dist/PostProcessing/ColorBlindCorrector.js.map +0 -1
- package/build/dist/PostProcessing/Index.js.map +0 -1
- package/build/dist/PostProcessing/PostProcessor.js +0 -2
- package/build/dist/PostProcessing/PostProcessor.js.map +0 -1
- package/build/dist/Promises.js +0 -205
- package/build/dist/Promises.js.map +0 -1
- package/build/dist/Resources/Gif.js +0 -490
- package/build/dist/Resources/Gif.js.map +0 -1
- package/build/dist/Resources/Index.js.map +0 -1
- package/build/dist/Resources/Resource.js +0 -74
- package/build/dist/Resources/Resource.js.map +0 -1
- package/build/dist/Resources/Sound/AudioContext.js +0 -16
- package/build/dist/Resources/Sound/AudioContext.js.map +0 -1
- package/build/dist/Resources/Sound/Index.js.map +0 -1
- package/build/dist/Resources/Sound/Sound.js +0 -257
- package/build/dist/Resources/Sound/Sound.js.map +0 -1
- package/build/dist/Resources/Sound/WebAudioInstance.js +0 -160
- package/build/dist/Resources/Sound/WebAudioInstance.js.map +0 -1
- package/build/dist/Scene.js +0 -443
- package/build/dist/Scene.js.map +0 -1
- package/build/dist/Screen.js +0 -611
- package/build/dist/Screen.js.map +0 -1
- package/build/dist/ScreenElement.js +0 -33
- package/build/dist/ScreenElement.js.map +0 -1
- package/build/dist/TileMap.js +0 -465
- package/build/dist/TileMap.js.map +0 -1
- package/build/dist/Timer.js +0 -198
- package/build/dist/Timer.js.map +0 -1
- package/build/dist/Traits/CapturePointer.js +0 -16
- package/build/dist/Traits/CapturePointer.js.map +0 -1
- package/build/dist/Traits/Index.js.map +0 -1
- package/build/dist/Traits/OffscreenCulling.js +0 -35
- package/build/dist/Traits/OffscreenCulling.js.map +0 -1
- package/build/dist/Trigger.js +0 -107
- package/build/dist/Trigger.js.map +0 -1
- package/build/dist/Util/Actors.js +0 -19
- package/build/dist/Util/Actors.js.map +0 -1
- package/build/dist/Util/Browser.js +0 -66
- package/build/dist/Util/Browser.js.map +0 -1
- package/build/dist/Util/CullingBox.js +0 -104
- package/build/dist/Util/CullingBox.js.map +0 -1
- package/build/dist/Util/Decorators.js +0 -78
- package/build/dist/Util/Decorators.js.map +0 -1
- package/build/dist/Util/Detector.js +0 -167
- package/build/dist/Util/Detector.js.map +0 -1
- package/build/dist/Util/DrawUtil.js +0 -115
- package/build/dist/Util/DrawUtil.js.map +0 -1
- package/build/dist/Util/EasingFunctions.js +0 -118
- package/build/dist/Util/EasingFunctions.js.map +0 -1
- package/build/dist/Util/Index.js.map +0 -1
- package/build/dist/Util/Log.js +0 -195
- package/build/dist/Util/Log.js.map +0 -1
- package/build/dist/Util/Observable.js +0 -60
- package/build/dist/Util/Observable.js.map +0 -1
- package/build/dist/Util/Pool.js +0 -72
- package/build/dist/Util/Pool.js.map +0 -1
- package/build/dist/Util/SortedList.js +0 -261
- package/build/dist/Util/SortedList.js.map +0 -1
- package/build/dist/Util/Sound.js +0 -22
- package/build/dist/Util/Sound.js.map +0 -1
- package/build/dist/Util/Util.js +0 -401
- package/build/dist/Util/Util.js.map +0 -1
- package/build/dist/Util/Watch.js +0 -67
- package/build/dist/Util/Watch.js.map +0 -1
- package/build/dist/Util/WebAudio.js +0 -62
- package/build/dist/Util/WebAudio.js.map +0 -1
- package/build/dist/index.js.map +0 -1
package/build/dist/Actor.js
DELETED
|
@@ -1,856 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Texture } from './Drawing/Texture';
|
|
8
|
-
import { KillEvent, PreUpdateEvent, PreDrawEvent, PostKillEvent, PreKillEvent } from './Events';
|
|
9
|
-
import { Sprite } from './Drawing/Sprite';
|
|
10
|
-
import { Animation } from './Drawing/Animation';
|
|
11
|
-
import { Logger } from './Util/Log';
|
|
12
|
-
import { ActionContext } from './Actions/ActionContext';
|
|
13
|
-
import { Vector, vec } from './Math/vector';
|
|
14
|
-
import { BodyComponent } from './Collision/BodyComponent';
|
|
15
|
-
import * as Traits from './Traits/Index';
|
|
16
|
-
import { CollisionType } from './Collision/CollisionType';
|
|
17
|
-
import { Entity } from './EntityComponentSystem/Entity';
|
|
18
|
-
import { CanvasDrawComponent } from './Drawing/CanvasDrawComponent';
|
|
19
|
-
import { TransformComponent } from './EntityComponentSystem/Components/TransformComponent';
|
|
20
|
-
import { MotionComponent } from './EntityComponentSystem/Components/MotionComponent';
|
|
21
|
-
import { GraphicsComponent } from './Graphics/GraphicsComponent';
|
|
22
|
-
import { Rectangle } from './Graphics/Rectangle';
|
|
23
|
-
import { Flags, Legacy } from './Flags';
|
|
24
|
-
import { obsolete } from './Util/Decorators';
|
|
25
|
-
import { ColliderComponent } from './Collision/ColliderComponent';
|
|
26
|
-
import { Shape } from './Collision/Colliders/Shape';
|
|
27
|
-
import { watch } from './Util/Watch';
|
|
28
|
-
import { Circle } from './Graphics/Circle';
|
|
29
|
-
/**
|
|
30
|
-
* Type guard for checking if something is an Actor
|
|
31
|
-
* @param x
|
|
32
|
-
*/
|
|
33
|
-
export function isActor(x) {
|
|
34
|
-
return x instanceof Actor;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* The most important primitive in Excalibur is an `Actor`. Anything that
|
|
38
|
-
* can move on the screen, collide with another `Actor`, respond to events,
|
|
39
|
-
* or interact with the current scene, must be an actor. An `Actor` **must**
|
|
40
|
-
* be part of a [[Scene]] for it to be drawn to the screen.
|
|
41
|
-
*/
|
|
42
|
-
export class Actor extends Entity {
|
|
43
|
-
// #endregion
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
* @param config
|
|
47
|
-
*/
|
|
48
|
-
constructor(config) {
|
|
49
|
-
super();
|
|
50
|
-
/**
|
|
51
|
-
* The anchor to apply all actor related transformations like rotation,
|
|
52
|
-
* translation, and scaling. By default the anchor is in the center of
|
|
53
|
-
* the actor. By default it is set to the center of the actor (.5, .5)
|
|
54
|
-
*
|
|
55
|
-
* An anchor of (.5, .5) will ensure that drawings are centered.
|
|
56
|
-
*
|
|
57
|
-
* Use `anchor.setTo` to set the anchor to a different point using
|
|
58
|
-
* values between 0 and 1. For example, anchoring to the top-left would be
|
|
59
|
-
* `Actor.anchor.setTo(0, 0)` and top-right would be `Actor.anchor.setTo(0, 1)`.
|
|
60
|
-
*/
|
|
61
|
-
this._anchor = watch(Vector.Half, (v) => this._handleAnchorChange(v));
|
|
62
|
-
/**
|
|
63
|
-
* Convenience reference to the global logger
|
|
64
|
-
*/
|
|
65
|
-
this.logger = Logger.getInstance();
|
|
66
|
-
/**
|
|
67
|
-
* The scene that the actor is in
|
|
68
|
-
*/
|
|
69
|
-
this.scene = null;
|
|
70
|
-
this.frames = {};
|
|
71
|
-
/**
|
|
72
|
-
* Access to the current drawing for the actor, this can be
|
|
73
|
-
* an [[Animation]], [[Sprite]], or [[Polygon]].
|
|
74
|
-
* Set drawings with [[setDrawing]].
|
|
75
|
-
* @deprecated
|
|
76
|
-
*/
|
|
77
|
-
this.currentDrawing = null;
|
|
78
|
-
/**
|
|
79
|
-
* Draggable helper
|
|
80
|
-
*/
|
|
81
|
-
this._draggable = false;
|
|
82
|
-
this._dragging = false;
|
|
83
|
-
this._pointerDragStartHandler = () => {
|
|
84
|
-
this._dragging = true;
|
|
85
|
-
};
|
|
86
|
-
this._pointerDragEndHandler = () => {
|
|
87
|
-
this._dragging = false;
|
|
88
|
-
};
|
|
89
|
-
this._pointerDragMoveHandler = (pe) => {
|
|
90
|
-
if (this._dragging) {
|
|
91
|
-
this.pos = pe.pointer.lastWorldPos;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
this._pointerDragLeaveHandler = (pe) => {
|
|
95
|
-
if (this._dragging) {
|
|
96
|
-
this.pos = pe.pointer.lastWorldPos;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Modify the current actor update pipeline.
|
|
101
|
-
*/
|
|
102
|
-
this.traits = [];
|
|
103
|
-
/**
|
|
104
|
-
* Whether or not to enable the [[Traits.CapturePointer]] trait that propagates
|
|
105
|
-
* pointer events to this actor
|
|
106
|
-
*/
|
|
107
|
-
this.enableCapturePointer = false;
|
|
108
|
-
/**
|
|
109
|
-
* Configuration for [[Traits.CapturePointer]] trait
|
|
110
|
-
*/
|
|
111
|
-
this.capturePointer = {
|
|
112
|
-
captureMoveEvents: false,
|
|
113
|
-
captureDragEvents: false
|
|
114
|
-
};
|
|
115
|
-
// #region Events
|
|
116
|
-
this._capturePointerEvents = [
|
|
117
|
-
'pointerup',
|
|
118
|
-
'pointerdown',
|
|
119
|
-
'pointermove',
|
|
120
|
-
'pointerenter',
|
|
121
|
-
'pointerleave',
|
|
122
|
-
'pointerdragstart',
|
|
123
|
-
'pointerdragend',
|
|
124
|
-
'pointerdragmove',
|
|
125
|
-
'pointerdragenter',
|
|
126
|
-
'pointerdragleave'
|
|
127
|
-
];
|
|
128
|
-
this._captureMoveEvents = [
|
|
129
|
-
'pointermove',
|
|
130
|
-
'pointerenter',
|
|
131
|
-
'pointerleave',
|
|
132
|
-
'pointerdragmove',
|
|
133
|
-
'pointerdragenter',
|
|
134
|
-
'pointerdragleave'
|
|
135
|
-
];
|
|
136
|
-
this._captureDragEvents = [
|
|
137
|
-
'pointerdragstart',
|
|
138
|
-
'pointerdragend',
|
|
139
|
-
'pointerdragmove',
|
|
140
|
-
'pointerdragenter',
|
|
141
|
-
'pointerdragleave'
|
|
142
|
-
];
|
|
143
|
-
const { name, x, y, pos, scale, width, height, radius, collider, vel, acc, rotation, angularVelocity, z, color, visible, anchor, collisionType, collisionGroup } = Object.assign({}, config);
|
|
144
|
-
this._setName(name);
|
|
145
|
-
this.anchor = anchor !== null && anchor !== void 0 ? anchor : Actor.defaults.anchor.clone();
|
|
146
|
-
this.addComponent(new TransformComponent());
|
|
147
|
-
this.pos = pos !== null && pos !== void 0 ? pos : vec(x !== null && x !== void 0 ? x : 0, y !== null && y !== void 0 ? y : 0);
|
|
148
|
-
this.rotation = rotation !== null && rotation !== void 0 ? rotation : 0;
|
|
149
|
-
this.scale = scale !== null && scale !== void 0 ? scale : vec(1, 1);
|
|
150
|
-
this.z = z !== null && z !== void 0 ? z : 0;
|
|
151
|
-
this.addComponent(new GraphicsComponent());
|
|
152
|
-
this.addComponent(new CanvasDrawComponent((ctx, delta) => this.draw(ctx, delta)));
|
|
153
|
-
this.addComponent(new MotionComponent());
|
|
154
|
-
this.vel = vel !== null && vel !== void 0 ? vel : Vector.Zero;
|
|
155
|
-
this.acc = acc !== null && acc !== void 0 ? acc : Vector.Zero;
|
|
156
|
-
this.angularVelocity = angularVelocity !== null && angularVelocity !== void 0 ? angularVelocity : 0;
|
|
157
|
-
this.addComponent(new BodyComponent());
|
|
158
|
-
this.body.collisionType = collisionType !== null && collisionType !== void 0 ? collisionType : CollisionType.Passive;
|
|
159
|
-
if (collisionGroup) {
|
|
160
|
-
this.body.group = collisionGroup;
|
|
161
|
-
}
|
|
162
|
-
if (collider) {
|
|
163
|
-
this.addComponent(new ColliderComponent(collider));
|
|
164
|
-
}
|
|
165
|
-
else if (radius) {
|
|
166
|
-
this.addComponent(new ColliderComponent(Shape.Circle(radius, this.anchor)));
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
if (width > 0 && height > 0) {
|
|
170
|
-
this.addComponent(new ColliderComponent(Shape.Box(width, height, this.anchor)));
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
this.addComponent(new ColliderComponent()); // no collider
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
this.graphics.visible = visible !== null && visible !== void 0 ? visible : true;
|
|
177
|
-
if (color) {
|
|
178
|
-
this.color = color;
|
|
179
|
-
if (width && height) {
|
|
180
|
-
this.graphics.add(new Rectangle({
|
|
181
|
-
color: color,
|
|
182
|
-
width,
|
|
183
|
-
height
|
|
184
|
-
}));
|
|
185
|
-
}
|
|
186
|
-
else if (radius) {
|
|
187
|
-
this.graphics.add(new Circle({
|
|
188
|
-
color: color,
|
|
189
|
-
radius
|
|
190
|
-
}));
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
// Build default pipeline
|
|
194
|
-
if (Flags.isEnabled(Legacy.LegacyDrawing)) {
|
|
195
|
-
// TODO remove offscreen trait after legacy drawing removed
|
|
196
|
-
this.traits.push(new Traits.OffscreenCulling());
|
|
197
|
-
}
|
|
198
|
-
this.traits.push(new Traits.CapturePointer());
|
|
199
|
-
// Build the action queue
|
|
200
|
-
this.actions = new ActionContext(this);
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* The physics body the is associated with this actor. The body is the container for all physical properties, like position, velocity,
|
|
204
|
-
* acceleration, mass, inertia, etc.
|
|
205
|
-
*/
|
|
206
|
-
get body() {
|
|
207
|
-
return this.get(BodyComponent);
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Access the Actor's built in [[TransformComponent]]
|
|
211
|
-
*/
|
|
212
|
-
get transform() {
|
|
213
|
-
return this.get(TransformComponent);
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Access the Actor's built in [[MotionComponent]]
|
|
217
|
-
*/
|
|
218
|
-
get motion() {
|
|
219
|
-
return this.get(MotionComponent);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Access to the Actor's built in [[GraphicsComponent]]
|
|
223
|
-
*/
|
|
224
|
-
get graphics() {
|
|
225
|
-
return this.get(GraphicsComponent);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Access to the Actor's build in [[ColliderComponent]]
|
|
229
|
-
*/
|
|
230
|
-
get collider() {
|
|
231
|
-
return this.get(ColliderComponent);
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Gets the position vector of the actor in pixels
|
|
235
|
-
*/
|
|
236
|
-
get pos() {
|
|
237
|
-
return this.transform.pos;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Sets the position vector of the actor in pixels
|
|
241
|
-
*/
|
|
242
|
-
set pos(thePos) {
|
|
243
|
-
this.transform.pos = thePos.clone();
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Gets the position vector of the actor from the last frame
|
|
247
|
-
*/
|
|
248
|
-
get oldPos() {
|
|
249
|
-
return this.body.oldPos;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Sets the position vector of the actor in the last frame
|
|
253
|
-
*/
|
|
254
|
-
set oldPos(thePos) {
|
|
255
|
-
this.body.oldPos.setTo(thePos.x, thePos.y);
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Gets the velocity vector of the actor in pixels/sec
|
|
259
|
-
*/
|
|
260
|
-
get vel() {
|
|
261
|
-
return this.motion.vel;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Sets the velocity vector of the actor in pixels/sec
|
|
265
|
-
*/
|
|
266
|
-
set vel(theVel) {
|
|
267
|
-
this.motion.vel = theVel.clone();
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Gets the velocity vector of the actor from the last frame
|
|
271
|
-
*/
|
|
272
|
-
get oldVel() {
|
|
273
|
-
return this.body.oldVel;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Sets the velocity vector of the actor from the last frame
|
|
277
|
-
*/
|
|
278
|
-
set oldVel(theVel) {
|
|
279
|
-
this.body.oldVel.setTo(theVel.x, theVel.y);
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Gets the acceleration vector of the actor in pixels/second/second. An acceleration pointing down such as (0, 100) may be
|
|
283
|
-
* useful to simulate a gravitational effect.
|
|
284
|
-
*/
|
|
285
|
-
get acc() {
|
|
286
|
-
return this.motion.acc;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Sets the acceleration vector of teh actor in pixels/second/second
|
|
290
|
-
*/
|
|
291
|
-
set acc(theAcc) {
|
|
292
|
-
this.motion.acc = theAcc.clone();
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Sets the acceleration of the actor from the last frame. This does not include the global acc [[Physics.acc]].
|
|
296
|
-
*/
|
|
297
|
-
set oldAcc(theAcc) {
|
|
298
|
-
this.body.oldAcc.setTo(theAcc.x, theAcc.y);
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Gets the acceleration of the actor from the last frame. This does not include the global acc [[Physics.acc]].
|
|
302
|
-
*/
|
|
303
|
-
get oldAcc() {
|
|
304
|
-
return this.body.oldAcc;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Gets the rotation of the actor in radians. 1 radian = 180/PI Degrees.
|
|
308
|
-
*/
|
|
309
|
-
get rotation() {
|
|
310
|
-
return this.transform.rotation;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Sets the rotation of the actor in radians. 1 radian = 180/PI Degrees.
|
|
314
|
-
*/
|
|
315
|
-
set rotation(theAngle) {
|
|
316
|
-
this.transform.rotation = theAngle;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Gets the rotational velocity of the actor in radians/second
|
|
320
|
-
*/
|
|
321
|
-
get angularVelocity() {
|
|
322
|
-
return this.motion.angularVelocity;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Sets the rotational velocity of the actor in radians/sec
|
|
326
|
-
*/
|
|
327
|
-
set angularVelocity(angularVelocity) {
|
|
328
|
-
this.motion.angularVelocity = angularVelocity;
|
|
329
|
-
}
|
|
330
|
-
get scale() {
|
|
331
|
-
return this.get(TransformComponent).scale;
|
|
332
|
-
}
|
|
333
|
-
set scale(scale) {
|
|
334
|
-
this.get(TransformComponent).scale = scale;
|
|
335
|
-
}
|
|
336
|
-
get anchor() {
|
|
337
|
-
return this._anchor;
|
|
338
|
-
}
|
|
339
|
-
set anchor(vec) {
|
|
340
|
-
this._anchor = watch(vec, (v) => this._handleAnchorChange(v));
|
|
341
|
-
this._handleAnchorChange(vec);
|
|
342
|
-
}
|
|
343
|
-
_handleAnchorChange(v) {
|
|
344
|
-
if (this.graphics) {
|
|
345
|
-
this.graphics.anchor = v;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Indicates whether the actor is physically in the viewport
|
|
350
|
-
*/
|
|
351
|
-
get isOffScreen() {
|
|
352
|
-
return this.hasTag('offscreen');
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* The visibility of an actor
|
|
356
|
-
* @deprecated Use [[GraphicsComponent.visible|Actor.graphics.visible]], will be removed in v0.26.0
|
|
357
|
-
*/
|
|
358
|
-
get visible() {
|
|
359
|
-
return this.graphics.visible;
|
|
360
|
-
}
|
|
361
|
-
set visible(isVisible) {
|
|
362
|
-
this.graphics.visible = isVisible;
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* The opacity of an actor.
|
|
366
|
-
*
|
|
367
|
-
* @deprecated Actor.opacity will be removed in v0.26.0, use [[GraphicsComponent.opacity|Actor.graphics.opacity]].
|
|
368
|
-
*/
|
|
369
|
-
get opacity() {
|
|
370
|
-
return this.graphics.opacity;
|
|
371
|
-
}
|
|
372
|
-
set opacity(opacity) {
|
|
373
|
-
this.graphics.opacity = opacity;
|
|
374
|
-
}
|
|
375
|
-
get draggable() {
|
|
376
|
-
return this._draggable;
|
|
377
|
-
}
|
|
378
|
-
set draggable(isDraggable) {
|
|
379
|
-
if (isDraggable) {
|
|
380
|
-
if (isDraggable && !this._draggable) {
|
|
381
|
-
this.on('pointerdragstart', this._pointerDragStartHandler);
|
|
382
|
-
this.on('pointerdragend', this._pointerDragEndHandler);
|
|
383
|
-
this.on('pointerdragmove', this._pointerDragMoveHandler);
|
|
384
|
-
this.on('pointerdragleave', this._pointerDragLeaveHandler);
|
|
385
|
-
}
|
|
386
|
-
else if (!isDraggable && this._draggable) {
|
|
387
|
-
this.off('pointerdragstart', this._pointerDragStartHandler);
|
|
388
|
-
this.off('pointerdragend', this._pointerDragEndHandler);
|
|
389
|
-
this.off('pointerdragmove', this._pointerDragMoveHandler);
|
|
390
|
-
this.off('pointerdragleave', this._pointerDragLeaveHandler);
|
|
391
|
-
}
|
|
392
|
-
this._draggable = isDraggable;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Sets the color of the actor. A rectangle of this color will be
|
|
397
|
-
* drawn if no [[Drawable]] is specified as the actors drawing.
|
|
398
|
-
*
|
|
399
|
-
* The default is `null` which prevents a rectangle from being drawn.
|
|
400
|
-
*/
|
|
401
|
-
get color() {
|
|
402
|
-
return this._color;
|
|
403
|
-
}
|
|
404
|
-
set color(v) {
|
|
405
|
-
this._color = v.clone();
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* `onInitialize` is called before the first update of the actor. This method is meant to be
|
|
409
|
-
* overridden. This is where initialization of child actors should take place.
|
|
410
|
-
*
|
|
411
|
-
* Synonymous with the event handler `.on('initialize', (evt) => {...})`
|
|
412
|
-
*/
|
|
413
|
-
onInitialize(_engine) {
|
|
414
|
-
// Override me
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* Initializes this actor and all it's child actors, meant to be called by the Scene before first update not by users of Excalibur.
|
|
418
|
-
*
|
|
419
|
-
* It is not recommended that internal excalibur methods be overridden, do so at your own risk.
|
|
420
|
-
*
|
|
421
|
-
* @internal
|
|
422
|
-
*/
|
|
423
|
-
_initialize(engine) {
|
|
424
|
-
super._initialize(engine);
|
|
425
|
-
for (const child of this.children) {
|
|
426
|
-
child._initialize(engine);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
_checkForPointerOptIn(eventName) {
|
|
430
|
-
if (eventName) {
|
|
431
|
-
const normalized = eventName.toLowerCase();
|
|
432
|
-
if (this._capturePointerEvents.indexOf(normalized) !== -1) {
|
|
433
|
-
this.enableCapturePointer = true;
|
|
434
|
-
if (this._captureMoveEvents.indexOf(normalized) !== -1) {
|
|
435
|
-
this.capturePointer.captureMoveEvents = true;
|
|
436
|
-
}
|
|
437
|
-
if (this._captureDragEvents.indexOf(normalized) !== -1) {
|
|
438
|
-
this.capturePointer.captureDragEvents = true;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
on(eventName, handler) {
|
|
444
|
-
this._checkForPointerOptIn(eventName);
|
|
445
|
-
super.on(eventName, handler);
|
|
446
|
-
}
|
|
447
|
-
once(eventName, handler) {
|
|
448
|
-
this._checkForPointerOptIn(eventName);
|
|
449
|
-
super.once(eventName, handler);
|
|
450
|
-
}
|
|
451
|
-
off(eventName, handler) {
|
|
452
|
-
super.off(eventName, handler);
|
|
453
|
-
}
|
|
454
|
-
// #endregion
|
|
455
|
-
/**
|
|
456
|
-
* It is not recommended that internal excalibur methods be overridden, do so at your own risk.
|
|
457
|
-
*
|
|
458
|
-
* Internal _prekill handler for [[onPreKill]] lifecycle event
|
|
459
|
-
* @internal
|
|
460
|
-
*/
|
|
461
|
-
_prekill(_scene) {
|
|
462
|
-
super.emit('prekill', new PreKillEvent(this));
|
|
463
|
-
this.onPreKill(_scene);
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* Safe to override onPreKill lifecycle event handler. Synonymous with `.on('prekill', (evt) =>{...})`
|
|
467
|
-
*
|
|
468
|
-
* `onPreKill` is called directly before an actor is killed and removed from its current [[Scene]].
|
|
469
|
-
*/
|
|
470
|
-
onPreKill(_scene) {
|
|
471
|
-
// Override me
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* It is not recommended that internal excalibur methods be overridden, do so at your own risk.
|
|
475
|
-
*
|
|
476
|
-
* Internal _prekill handler for [[onPostKill]] lifecycle event
|
|
477
|
-
* @internal
|
|
478
|
-
*/
|
|
479
|
-
_postkill(_scene) {
|
|
480
|
-
super.emit('postkill', new PostKillEvent(this));
|
|
481
|
-
this.onPostKill(_scene);
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Safe to override onPostKill lifecycle event handler. Synonymous with `.on('postkill', (evt) => {...})`
|
|
485
|
-
*
|
|
486
|
-
* `onPostKill` is called directly after an actor is killed and remove from its current [[Scene]].
|
|
487
|
-
*/
|
|
488
|
-
onPostKill(_scene) {
|
|
489
|
-
// Override me
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* If the current actor is a member of the scene, this will remove
|
|
493
|
-
* it from the scene graph. It will no longer be drawn or updated.
|
|
494
|
-
*/
|
|
495
|
-
kill() {
|
|
496
|
-
if (this.scene) {
|
|
497
|
-
this._prekill(this.scene);
|
|
498
|
-
this.emit('kill', new KillEvent(this));
|
|
499
|
-
super.kill();
|
|
500
|
-
this._postkill(this.scene);
|
|
501
|
-
}
|
|
502
|
-
else {
|
|
503
|
-
this.logger.warn('Cannot kill actor, it was never added to the Scene');
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* If the current actor is killed, it will now not be killed.
|
|
508
|
-
*/
|
|
509
|
-
unkill() {
|
|
510
|
-
this.active = true;
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Indicates wether the actor has been killed.
|
|
514
|
-
*/
|
|
515
|
-
isKilled() {
|
|
516
|
-
return !this.active;
|
|
517
|
-
}
|
|
518
|
-
setDrawing(key) {
|
|
519
|
-
key = key.toString();
|
|
520
|
-
if (this.currentDrawing !== this.frames[key]) {
|
|
521
|
-
if (this.frames[key] != null) {
|
|
522
|
-
this.frames[key].reset();
|
|
523
|
-
this.currentDrawing = this.frames[key];
|
|
524
|
-
}
|
|
525
|
-
else {
|
|
526
|
-
Logger.getInstance().error(`the specified drawing key ${key} does not exist`);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
if (this.currentDrawing && this.currentDrawing instanceof Animation) {
|
|
530
|
-
this.currentDrawing.tick(0);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
addDrawing() {
|
|
534
|
-
if (arguments.length === 2) {
|
|
535
|
-
this.frames[arguments[0]] = arguments[1];
|
|
536
|
-
if (!this.currentDrawing) {
|
|
537
|
-
this.currentDrawing = arguments[1];
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
else {
|
|
541
|
-
if (arguments[0] instanceof Sprite) {
|
|
542
|
-
this.addDrawing('default', arguments[0]);
|
|
543
|
-
}
|
|
544
|
-
if (arguments[0] instanceof Texture) {
|
|
545
|
-
this.addDrawing('default', arguments[0].asSprite());
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
/**
|
|
550
|
-
* Gets the z-index of an actor. The z-index determines the relative order an actor is drawn in.
|
|
551
|
-
* Actors with a higher z-index are drawn on top of actors with a lower z-index
|
|
552
|
-
*/
|
|
553
|
-
get z() {
|
|
554
|
-
return this.get(TransformComponent).z;
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* @deprecated Use [[Actor.z]]
|
|
558
|
-
*/
|
|
559
|
-
getZIndex() {
|
|
560
|
-
return this.get(TransformComponent).z;
|
|
561
|
-
}
|
|
562
|
-
/**
|
|
563
|
-
* Sets the z-index of an actor and updates it in the drawing list for the scene.
|
|
564
|
-
* The z-index determines the relative order an actor is drawn in.
|
|
565
|
-
* Actors with a higher z-index are drawn on top of actors with a lower z-index
|
|
566
|
-
* @param newZ new z-index to assign
|
|
567
|
-
*/
|
|
568
|
-
set z(newZ) {
|
|
569
|
-
this.get(TransformComponent).z = newZ;
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
* @param newIndex new z-index to assign
|
|
573
|
-
* @deprecated Use [[Actor.z]]
|
|
574
|
-
*/
|
|
575
|
-
setZIndex(newIndex) {
|
|
576
|
-
this.get(TransformComponent).z = newIndex;
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* Get the center point of an actor
|
|
580
|
-
*/
|
|
581
|
-
get center() {
|
|
582
|
-
return new Vector(this.pos.x + this.width / 2 - this.anchor.x * this.width, this.pos.y + this.height / 2 - this.anchor.y * this.height);
|
|
583
|
-
}
|
|
584
|
-
get width() {
|
|
585
|
-
return this.collider.localBounds.width * this.getGlobalScale().x;
|
|
586
|
-
}
|
|
587
|
-
get height() {
|
|
588
|
-
return this.collider.localBounds.height * this.getGlobalScale().y;
|
|
589
|
-
}
|
|
590
|
-
/**
|
|
591
|
-
* Gets this actor's rotation taking into account any parent relationships
|
|
592
|
-
*
|
|
593
|
-
* @returns Rotation angle in radians
|
|
594
|
-
*/
|
|
595
|
-
getGlobalRotation() {
|
|
596
|
-
return this.get(TransformComponent).globalRotation;
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* Gets an actor's world position taking into account parent relationships, scaling, rotation, and translation
|
|
600
|
-
*
|
|
601
|
-
* @returns Position in world coordinates
|
|
602
|
-
*/
|
|
603
|
-
getGlobalPos() {
|
|
604
|
-
return this.get(TransformComponent).globalPos;
|
|
605
|
-
}
|
|
606
|
-
/**
|
|
607
|
-
* Gets the global scale of the Actor
|
|
608
|
-
*/
|
|
609
|
-
getGlobalScale() {
|
|
610
|
-
return this.get(TransformComponent).globalScale;
|
|
611
|
-
}
|
|
612
|
-
// #region Collision
|
|
613
|
-
/**
|
|
614
|
-
* Tests whether the x/y specified are contained in the actor
|
|
615
|
-
* @param x X coordinate to test (in world coordinates)
|
|
616
|
-
* @param y Y coordinate to test (in world coordinates)
|
|
617
|
-
* @param recurse checks whether the x/y are contained in any child actors (if they exist).
|
|
618
|
-
*/
|
|
619
|
-
contains(x, y, recurse = false) {
|
|
620
|
-
const point = vec(x, y);
|
|
621
|
-
const collider = this.get(ColliderComponent);
|
|
622
|
-
collider.update();
|
|
623
|
-
const geom = collider.get();
|
|
624
|
-
if (!geom) {
|
|
625
|
-
return false;
|
|
626
|
-
}
|
|
627
|
-
const containment = geom.contains(point);
|
|
628
|
-
if (recurse) {
|
|
629
|
-
return (containment ||
|
|
630
|
-
this.children.some((child) => {
|
|
631
|
-
return child.contains(x, y, true);
|
|
632
|
-
}));
|
|
633
|
-
}
|
|
634
|
-
return containment;
|
|
635
|
-
}
|
|
636
|
-
/**
|
|
637
|
-
* Returns true if the two actor.collider's surfaces are less than or equal to the distance specified from each other
|
|
638
|
-
* @param actor Actor to test
|
|
639
|
-
* @param distance Distance in pixels to test
|
|
640
|
-
*/
|
|
641
|
-
within(actor, distance) {
|
|
642
|
-
const collider = this.get(ColliderComponent);
|
|
643
|
-
const otherCollider = actor.get(ColliderComponent);
|
|
644
|
-
const me = collider.get();
|
|
645
|
-
const other = otherCollider.get();
|
|
646
|
-
if (me && other) {
|
|
647
|
-
return me.getClosestLineBetween(other).getLength() <= distance;
|
|
648
|
-
}
|
|
649
|
-
return false;
|
|
650
|
-
}
|
|
651
|
-
// #endregion
|
|
652
|
-
// #region Update
|
|
653
|
-
/**
|
|
654
|
-
* Called by the Engine, updates the state of the actor
|
|
655
|
-
* @internal
|
|
656
|
-
* @param engine The reference to the current game engine
|
|
657
|
-
* @param delta The time elapsed since the last update in milliseconds
|
|
658
|
-
*/
|
|
659
|
-
update(engine, delta) {
|
|
660
|
-
this._initialize(engine);
|
|
661
|
-
this._preupdate(engine, delta);
|
|
662
|
-
// Tick animations
|
|
663
|
-
const drawing = this.currentDrawing;
|
|
664
|
-
if (drawing && drawing instanceof Animation) {
|
|
665
|
-
drawing.tick(delta, engine.stats.currFrame.id);
|
|
666
|
-
}
|
|
667
|
-
// Update action context
|
|
668
|
-
this.actions.update(delta);
|
|
669
|
-
// Update actor pipeline (movement, collision detection, event propagation, offscreen culling)
|
|
670
|
-
for (const trait of this.traits) {
|
|
671
|
-
trait.update(this, engine, delta);
|
|
672
|
-
}
|
|
673
|
-
// Update child actors
|
|
674
|
-
// for (let i = 0; i < this.children.length; i++) {
|
|
675
|
-
// this.children[i].update(engine, delta);
|
|
676
|
-
// }
|
|
677
|
-
this._postupdate(engine, delta);
|
|
678
|
-
}
|
|
679
|
-
/**
|
|
680
|
-
* Safe to override onPreUpdate lifecycle event handler. Synonymous with `.on('preupdate', (evt) =>{...})`
|
|
681
|
-
*
|
|
682
|
-
* `onPreUpdate` is called directly before an actor is updated.
|
|
683
|
-
*/
|
|
684
|
-
onPreUpdate(_engine, _delta) {
|
|
685
|
-
// Override me
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* Safe to override onPostUpdate lifecycle event handler. Synonymous with `.on('postupdate', (evt) =>{...})`
|
|
689
|
-
*
|
|
690
|
-
* `onPostUpdate` is called directly after an actor is updated.
|
|
691
|
-
*/
|
|
692
|
-
onPostUpdate(_engine, _delta) {
|
|
693
|
-
// Override me
|
|
694
|
-
}
|
|
695
|
-
/**
|
|
696
|
-
* It is not recommended that internal excalibur methods be overridden, do so at your own risk.
|
|
697
|
-
*
|
|
698
|
-
* Internal _preupdate handler for [[onPreUpdate]] lifecycle event
|
|
699
|
-
* @internal
|
|
700
|
-
*/
|
|
701
|
-
_preupdate(engine, delta) {
|
|
702
|
-
this.emit('preupdate', new PreUpdateEvent(engine, delta, this));
|
|
703
|
-
this.onPreUpdate(engine, delta);
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* It is not recommended that internal excalibur methods be overridden, do so at your own risk.
|
|
707
|
-
*
|
|
708
|
-
* Internal _preupdate handler for [[onPostUpdate]] lifecycle event
|
|
709
|
-
* @internal
|
|
710
|
-
*/
|
|
711
|
-
_postupdate(engine, delta) {
|
|
712
|
-
this.emit('postupdate', new PreUpdateEvent(engine, delta, this));
|
|
713
|
-
this.onPostUpdate(engine, delta);
|
|
714
|
-
}
|
|
715
|
-
// endregion
|
|
716
|
-
// #region Drawing
|
|
717
|
-
/**
|
|
718
|
-
* Called by the Engine, draws the actor to the screen
|
|
719
|
-
* @param ctx The rendering context
|
|
720
|
-
* @param delta The time since the last draw in milliseconds
|
|
721
|
-
*
|
|
722
|
-
* **Warning** only works with Flags.useLegacyDrawing() enabled
|
|
723
|
-
* @deprecated Use Actor.graphics, will be removed in v0.26.0
|
|
724
|
-
*/
|
|
725
|
-
draw(ctx, delta) {
|
|
726
|
-
var _a;
|
|
727
|
-
// translate canvas by anchor offset
|
|
728
|
-
ctx.save();
|
|
729
|
-
if (this.currentDrawing) {
|
|
730
|
-
ctx.translate(-(this.width * this.anchor.x), -(this.height * this.anchor.y));
|
|
731
|
-
this._predraw(ctx, delta);
|
|
732
|
-
const drawing = this.currentDrawing;
|
|
733
|
-
// See https://github.com/excaliburjs/Excalibur/pull/619 for discussion on this formula
|
|
734
|
-
const offsetX = (this.width - drawing.width * drawing.scale.x) * this.anchor.x;
|
|
735
|
-
const offsetY = (this.height - drawing.height * drawing.scale.y) * this.anchor.y;
|
|
736
|
-
this.currentDrawing.draw({ ctx, x: offsetX, y: offsetY, opacity: this.graphics.opacity });
|
|
737
|
-
}
|
|
738
|
-
else {
|
|
739
|
-
this._predraw(ctx, delta);
|
|
740
|
-
if (this.color && this.collider) {
|
|
741
|
-
// update collider geometry based on transform
|
|
742
|
-
const collider = this.get(ColliderComponent);
|
|
743
|
-
collider.update();
|
|
744
|
-
if (collider && !collider.bounds.hasZeroDimensions()) {
|
|
745
|
-
// Colliders are already shifted by anchor, unshift
|
|
746
|
-
ctx.globalAlpha = this.graphics.opacity;
|
|
747
|
-
(_a = collider.get()) === null || _a === void 0 ? void 0 : _a.draw(ctx, this.color, vec(0, 0));
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
ctx.restore();
|
|
752
|
-
this._postdraw(ctx, delta);
|
|
753
|
-
}
|
|
754
|
-
/**
|
|
755
|
-
* Safe to override onPreDraw lifecycle event handler. Synonymous with `.on('predraw', (evt) =>{...})`
|
|
756
|
-
*
|
|
757
|
-
* `onPreDraw` is called directly before an actor is drawn, but after local transforms are made.
|
|
758
|
-
*
|
|
759
|
-
* **Warning** only works with Flags.useLegacyDrawing() enabled
|
|
760
|
-
* @deprecated Use Actor.graphics.onPostDraw, will be removed in v0.26.0
|
|
761
|
-
*/
|
|
762
|
-
onPreDraw(_ctx, _delta) {
|
|
763
|
-
// Override me
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
|
-
* Safe to override onPostDraw lifecycle event handler. Synonymous with `.on('postdraw', (evt) =>{...})`
|
|
767
|
-
*
|
|
768
|
-
* `onPostDraw` is called directly after an actor is drawn, and before local transforms are removed.
|
|
769
|
-
*
|
|
770
|
-
* **Warning** only works with Flags.useLegacyDrawing() enabled
|
|
771
|
-
* @deprecated Use Actor.graphics.onPostDraw, will be removed in v0.26.0
|
|
772
|
-
*/
|
|
773
|
-
onPostDraw(_ctx, _delta) {
|
|
774
|
-
// Override me
|
|
775
|
-
}
|
|
776
|
-
/**
|
|
777
|
-
* It is not recommended that internal excalibur methods be overridden, do so at your own risk.
|
|
778
|
-
*
|
|
779
|
-
* Internal _predraw handler for [[onPreDraw]] lifecycle event
|
|
780
|
-
*
|
|
781
|
-
* **Warning** only works with Flags.useLegacyDrawing() enabled
|
|
782
|
-
* @deprecated Use Actor.graphics.onPreDraw, will be removed in v0.26.0
|
|
783
|
-
* @internal
|
|
784
|
-
*/
|
|
785
|
-
_predraw(ctx, delta) {
|
|
786
|
-
this.emit('predraw', new PreDrawEvent(ctx, delta, this));
|
|
787
|
-
this.onPreDraw(ctx, delta);
|
|
788
|
-
}
|
|
789
|
-
/**
|
|
790
|
-
* It is not recommended that internal excalibur methods be overridden, do so at your own risk.
|
|
791
|
-
*
|
|
792
|
-
* Internal _postdraw handler for [[onPostDraw]] lifecycle event
|
|
793
|
-
*
|
|
794
|
-
* **Warning** only works with Flags.useLegacyDrawing() enabled
|
|
795
|
-
* @deprecated Use Actor.graphics.onPostDraw, will be removed in v0.26.0
|
|
796
|
-
* @internal
|
|
797
|
-
*/
|
|
798
|
-
_postdraw(ctx, delta) {
|
|
799
|
-
this.emit('postdraw', new PreDrawEvent(ctx, delta, this));
|
|
800
|
-
this.onPostDraw(ctx, delta);
|
|
801
|
-
}
|
|
802
|
-
/**
|
|
803
|
-
* Called by the Engine, draws the actors debugging to the screen
|
|
804
|
-
* @param ctx The rendering context
|
|
805
|
-
*
|
|
806
|
-
*
|
|
807
|
-
* **Warning** only works with Flags.useLegacyDrawing() enabled
|
|
808
|
-
* @deprecated Use Actor.graphics.onPostDraw, will be removed in v0.26.0
|
|
809
|
-
* @internal
|
|
810
|
-
*/
|
|
811
|
-
/* istanbul ignore next */
|
|
812
|
-
debugDraw(_ctx) {
|
|
813
|
-
// pass
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
// #region Properties
|
|
817
|
-
/**
|
|
818
|
-
* Set defaults for all Actors
|
|
819
|
-
*/
|
|
820
|
-
Actor.defaults = {
|
|
821
|
-
anchor: Vector.Half
|
|
822
|
-
};
|
|
823
|
-
__decorate([
|
|
824
|
-
obsolete({ message: 'Actor.visible will be removed in v0.26.0', alternateMethod: 'Use Actor.graphics.visible' })
|
|
825
|
-
], Actor.prototype, "visible", null);
|
|
826
|
-
__decorate([
|
|
827
|
-
obsolete({
|
|
828
|
-
message: 'Actor.opacity will be removed in v0.26.0',
|
|
829
|
-
alternateMethod: 'Use Actor.graphics.opacity'
|
|
830
|
-
})
|
|
831
|
-
], Actor.prototype, "opacity", null);
|
|
832
|
-
__decorate([
|
|
833
|
-
obsolete({
|
|
834
|
-
message: 'Actor.setDrawing will be removed in v0.26.0',
|
|
835
|
-
alternateMethod: 'Use Actor.graphics.show() or Actor.graphics.use()'
|
|
836
|
-
})
|
|
837
|
-
], Actor.prototype, "setDrawing", null);
|
|
838
|
-
__decorate([
|
|
839
|
-
obsolete({
|
|
840
|
-
message: 'Actor.addDrawing will be removed in v0.26.0',
|
|
841
|
-
alternateMethod: 'Use Actor.graphics.add()'
|
|
842
|
-
})
|
|
843
|
-
], Actor.prototype, "addDrawing", null);
|
|
844
|
-
__decorate([
|
|
845
|
-
obsolete({
|
|
846
|
-
message: 'Actor.getZIndex will be removed in v0.26.0',
|
|
847
|
-
alternateMethod: 'Use Actor.transform.z or Actor.z'
|
|
848
|
-
})
|
|
849
|
-
], Actor.prototype, "getZIndex", null);
|
|
850
|
-
__decorate([
|
|
851
|
-
obsolete({
|
|
852
|
-
message: 'Actor.setZIndex will be removed in v0.26.0',
|
|
853
|
-
alternateMethod: 'Use Actor.transform.z or Actor.z'
|
|
854
|
-
})
|
|
855
|
-
], Actor.prototype, "setZIndex", null);
|
|
856
|
-
//# sourceMappingURL=Actor.js.map
|