excalibur 0.28.3 → 0.28.4
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/.gitattributes +63 -63
- package/CHANGELOG.md +2003 -1955
- package/LICENSE.md +25 -25
- package/README.md +134 -134
- package/STYLEGUIDE.md +136 -136
- package/build/dist/Actions/Action/ActionSequence.js +31 -0
- package/build/dist/Actions/Action/ActionSequence.js.map +1 -0
- package/build/dist/Actions/Action/Blink.js +54 -0
- package/build/dist/Actions/Action/Blink.js.map +1 -0
- package/build/dist/Actions/Action/CallMethod.js +21 -0
- package/build/dist/Actions/Action/CallMethod.js.map +1 -0
- package/build/dist/Actions/Action/Delay.js +26 -0
- package/build/dist/Actions/Action/Delay.js.map +1 -0
- package/build/dist/Actions/Action/Die.js +22 -0
- package/build/dist/Actions/Action/Die.js.map +1 -0
- package/build/dist/Actions/Action/EaseBy.js +70 -0
- package/build/dist/Actions/Action/EaseBy.js.map +1 -0
- package/build/dist/Actions/Action/EaseTo.js +69 -0
- package/build/dist/Actions/Action/EaseTo.js.map +1 -0
- package/build/dist/Actions/Action/Fade.js +48 -0
- package/build/dist/Actions/Action/Fade.js.map +1 -0
- package/build/dist/Actions/Action/Follow.js +56 -0
- package/build/dist/Actions/Action/Follow.js.map +1 -0
- package/build/dist/Actions/Action/Meet.js +54 -0
- package/build/dist/Actions/Action/Meet.js.map +1 -0
- package/build/dist/Actions/Action/MoveBy.js +48 -0
- package/build/dist/Actions/Action/MoveBy.js.map +1 -0
- package/build/dist/Actions/Action/MoveTo.js +41 -0
- package/build/dist/Actions/Action/MoveTo.js.map +1 -0
- package/build/dist/Actions/Action/ParallelActions.js +23 -0
- package/build/dist/Actions/Action/ParallelActions.js.map +1 -0
- package/build/dist/Actions/Action/Repeat.js +31 -0
- package/build/dist/Actions/Action/Repeat.js.map +1 -0
- package/build/dist/Actions/Action/RepeatForever.js +37 -0
- package/build/dist/Actions/Action/RepeatForever.js.map +1 -0
- package/build/dist/Actions/Action/RotateBy.js +95 -0
- package/build/dist/Actions/Action/RotateBy.js.map +1 -0
- package/build/dist/Actions/Action/RotateTo.js +91 -0
- package/build/dist/Actions/Action/RotateTo.js.map +1 -0
- package/build/dist/Actions/Action/ScaleBy.js +46 -0
- package/build/dist/Actions/Action/ScaleBy.js.map +1 -0
- package/build/dist/Actions/Action/ScaleTo.js +58 -0
- package/build/dist/Actions/Action/ScaleTo.js.map +1 -0
- package/build/dist/Actions/Action.js +2 -0
- package/build/dist/Actions/Action.js.map +1 -0
- package/build/dist/Actions/ActionContext.js +322 -0
- package/build/dist/Actions/ActionContext.js.map +1 -0
- package/build/dist/Actions/ActionQueue.js +87 -0
- package/build/dist/Actions/ActionQueue.js.map +1 -0
- package/build/dist/Actions/Actionable.js +2 -0
- package/build/dist/Actions/Actionable.js.map +1 -0
- package/build/dist/Actions/ActionsComponent.js +195 -0
- package/build/dist/Actions/ActionsComponent.js.map +1 -0
- package/build/dist/Actions/ActionsSystem.js +30 -0
- package/build/dist/Actions/ActionsSystem.js.map +1 -0
- package/build/dist/Actions/Index.js +26 -0
- package/build/dist/Actions/Index.js.map +1 -0
- package/build/dist/Actions/RotationType.js +27 -0
- package/build/dist/Actions/RotationType.js.map +1 -0
- package/build/dist/Actor.js +629 -0
- package/build/dist/Actor.js.map +1 -0
- package/build/dist/Camera.js +660 -0
- package/build/dist/Camera.js.map +1 -0
- package/build/dist/Collision/BoundingBox.js +415 -0
- package/build/dist/Collision/BoundingBox.js.map +1 -0
- package/build/dist/Collision/ColliderComponent.js +202 -0
- package/build/dist/Collision/ColliderComponent.js.map +1 -0
- package/build/dist/Collision/Colliders/CircleCollider.js +226 -0
- package/build/dist/Collision/Colliders/CircleCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/ClosestLineJumpTable.js +211 -0
- package/build/dist/Collision/Colliders/ClosestLineJumpTable.js.map +1 -0
- package/build/dist/Collision/Colliders/Collider.js +32 -0
- package/build/dist/Collision/Colliders/Collider.js.map +1 -0
- package/build/dist/Collision/Colliders/CollisionJumpTable.js +300 -0
- package/build/dist/Collision/Colliders/CollisionJumpTable.js.map +1 -0
- package/build/dist/Collision/Colliders/EdgeCollider.js +229 -0
- package/build/dist/Collision/Colliders/EdgeCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/PolygonCollider.js +556 -0
- package/build/dist/Collision/Colliders/PolygonCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/SeparatingAxis.js +67 -0
- package/build/dist/Collision/Colliders/SeparatingAxis.js.map +1 -0
- package/build/dist/Collision/Colliders/Shape.js +99 -0
- package/build/dist/Collision/Colliders/Shape.js.map +1 -0
- package/build/dist/Collision/CollisionType.js +33 -0
- package/build/dist/Collision/CollisionType.js.map +1 -0
- package/build/dist/Collision/Detection/CollisionContact.js +51 -0
- package/build/dist/Collision/Detection/CollisionContact.js.map +1 -0
- package/build/dist/Collision/Detection/CollisionProcessor.js +2 -0
- package/build/dist/Collision/Detection/CollisionProcessor.js.map +1 -0
- package/build/dist/Collision/Detection/DynamicTree.js +442 -0
- package/build/dist/Collision/Detection/DynamicTree.js.map +1 -0
- package/build/dist/Collision/Detection/Pair.js +92 -0
- package/build/dist/Collision/Detection/Pair.js.map +1 -0
- package/build/dist/Collision/Detection/QuadTree.js +193 -0
- package/build/dist/Collision/Detection/QuadTree.js.map +1 -0
- package/build/dist/Collision/Group/CollisionGroup.js +3 -3
- package/build/dist/Collision/Integrator.js +25 -0
- package/build/dist/Collision/Integrator.js.map +1 -0
- package/build/dist/Collision/MotionSystem.js +35 -0
- package/build/dist/Collision/MotionSystem.js.map +1 -0
- package/build/dist/Collision/Physics.js +163 -0
- package/build/dist/Collision/Physics.js.map +1 -0
- package/build/dist/Collision/PhysicsWorld.js +10 -0
- package/build/dist/Collision/PhysicsWorld.js.map +1 -0
- package/build/dist/Collision/Side.js +51 -0
- package/build/dist/Collision/Side.js.map +1 -0
- package/build/dist/Collision/Solver/ArcadeSolver.js +154 -0
- package/build/dist/Collision/Solver/ArcadeSolver.js.map +1 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.js +87 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.js.map +1 -0
- package/build/dist/Collision/Solver/RealisticSolver.js +293 -0
- package/build/dist/Collision/Solver/RealisticSolver.js.map +1 -0
- package/build/dist/Collision/Solver/Solver.js +2 -0
- package/build/dist/Collision/Solver/Solver.js.map +1 -0
- package/build/dist/Color.js +417 -0
- package/build/dist/Color.js.map +1 -0
- package/build/dist/Configurable.js +32 -0
- package/build/dist/Configurable.js.map +1 -0
- package/build/dist/Debug/Debug.d.ts +11 -0
- package/build/dist/Debug/Debug.js +385 -0
- package/build/dist/Debug/Debug.js.map +1 -0
- package/build/dist/Debug/DebugFlags.js +40 -0
- package/build/dist/Debug/DebugFlags.js.map +1 -0
- package/build/dist/Debug/DebugSystem.js +263 -0
- package/build/dist/Debug/DebugSystem.js.map +1 -0
- package/build/dist/Debug/index.js +4 -0
- package/build/dist/Debug/index.js.map +1 -0
- package/build/dist/Deprecated.js +2 -0
- package/build/dist/Deprecated.js.map +1 -0
- package/build/dist/Engine.js +986 -0
- package/build/dist/Engine.js.map +1 -0
- package/build/dist/EntityComponentSystem/Component.js +65 -0
- package/build/dist/EntityComponentSystem/Component.js.map +1 -0
- package/build/dist/EntityComponentSystem/Components/MotionComponent.js +33 -0
- package/build/dist/EntityComponentSystem/Components/MotionComponent.js.map +1 -0
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js +107 -0
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js.map +1 -0
- package/build/dist/EntityComponentSystem/Entity.js +487 -0
- package/build/dist/EntityComponentSystem/Entity.js.map +1 -0
- package/build/dist/EntityComponentSystem/EntityManager.js +137 -0
- package/build/dist/EntityComponentSystem/EntityManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/Query.js +90 -0
- package/build/dist/EntityComponentSystem/Query.js.map +1 -0
- package/build/dist/EntityComponentSystem/QueryManager.js +90 -0
- package/build/dist/EntityComponentSystem/QueryManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/System.js +76 -0
- package/build/dist/EntityComponentSystem/System.js.map +1 -0
- package/build/dist/EntityComponentSystem/SystemManager.js +104 -0
- package/build/dist/EntityComponentSystem/SystemManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/Util.js +5 -0
- package/build/dist/EntityComponentSystem/Util.js.map +1 -0
- package/build/dist/EntityComponentSystem/World.js +55 -0
- package/build/dist/EntityComponentSystem/World.js.map +1 -0
- package/build/dist/EntityComponentSystem/index.js +11 -0
- package/build/dist/EntityComponentSystem/index.js.map +1 -0
- package/build/dist/EventDispatcher.js +122 -0
- package/build/dist/EventDispatcher.js.map +1 -0
- package/build/dist/EventEmitter.js +86 -0
- package/build/dist/EventEmitter.js.map +1 -0
- package/build/dist/Events/ExEvent.js +12 -0
- package/build/dist/Events/ExEvent.js.map +1 -0
- package/build/dist/Events/MediaEvents.js +75 -0
- package/build/dist/Events/MediaEvents.js.map +1 -0
- package/build/dist/Events/PointerEvents.js +52 -0
- package/build/dist/Events/PointerEvents.js.map +1 -0
- package/build/dist/Events.js +473 -0
- package/build/dist/Events.js.map +1 -0
- package/build/dist/Flags.js +67 -0
- package/build/dist/Flags.js.map +1 -0
- package/build/dist/Graphics/Animation.js +344 -0
- package/build/dist/Graphics/Animation.js.map +1 -0
- package/build/dist/Graphics/Canvas.js +38 -0
- package/build/dist/Graphics/Canvas.js.map +1 -0
- package/build/dist/Graphics/Circle.js +48 -0
- package/build/dist/Graphics/Circle.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js +2 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js +237 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js +481 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js.map +1 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.frag.glsl +52 -52
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js +174 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.vert.glsl +37 -37
- package/build/dist/Graphics/Context/debug-text.js +47 -0
- package/build/dist/Graphics/Context/debug-text.js.map +1 -0
- package/build/dist/Graphics/Context/draw-call.js +16 -0
- package/build/dist/Graphics/Context/draw-call.js.map +1 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.frag.glsl +32 -32
- package/build/dist/Graphics/Context/image-renderer/image-renderer.js +246 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.vert.glsl +32 -32
- package/build/dist/Graphics/Context/line-renderer/line-fragment.glsl +10 -10
- package/build/dist/Graphics/Context/line-renderer/line-renderer.js +90 -0
- package/build/dist/Graphics/Context/line-renderer/line-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/line-renderer/line-vertex.glsl +14 -14
- package/build/dist/Graphics/Context/material-renderer/material-renderer.js +23 -2
- package/build/dist/Graphics/Context/material-renderer/material-renderer.js.map +1 -1
- package/build/dist/Graphics/Context/material.d.ts +2 -0
- package/build/dist/Graphics/Context/material.js +72 -0
- package/build/dist/Graphics/Context/material.js.map +1 -0
- package/build/dist/Graphics/Context/point-renderer/point-fragment.glsl +19 -19
- package/build/dist/Graphics/Context/point-renderer/point-renderer.js +91 -0
- package/build/dist/Graphics/Context/point-renderer/point-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/point-renderer/point-vertex.glsl +11 -11
- package/build/dist/Graphics/Context/quad-index-buffer.js +67 -0
- package/build/dist/Graphics/Context/quad-index-buffer.js.map +1 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.frag.glsl +85 -85
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js +305 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.vert.glsl +42 -42
- package/build/dist/Graphics/Context/render-source.js +16 -0
- package/build/dist/Graphics/Context/render-source.js.map +1 -0
- package/build/dist/Graphics/Context/render-target.js +65 -0
- package/build/dist/Graphics/Context/render-target.js.map +1 -0
- package/build/dist/Graphics/Context/renderer.js +2 -0
- package/build/dist/Graphics/Context/renderer.js.map +1 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-fragment.glsl +13 -13
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js +56 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js.map +1 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-vertex.glsl +11 -11
- package/build/dist/Graphics/Context/state-stack.js +37 -0
- package/build/dist/Graphics/Context/state-stack.js.map +1 -0
- package/build/dist/Graphics/Context/texture-loader.js +109 -0
- package/build/dist/Graphics/Context/texture-loader.js.map +1 -0
- package/build/dist/Graphics/Context/transform-stack.js +30 -0
- package/build/dist/Graphics/Context/transform-stack.js.map +1 -0
- package/build/dist/Graphics/Context/vertex-buffer.js +53 -0
- package/build/dist/Graphics/Context/vertex-buffer.js.map +1 -0
- package/build/dist/Graphics/Context/webgl-util.js +79 -0
- package/build/dist/Graphics/Context/webgl-util.js.map +1 -0
- package/build/dist/Graphics/DebugGraphicsComponent.d.ts +3 -2
- package/build/dist/Graphics/DebugGraphicsComponent.js +16 -0
- package/build/dist/Graphics/DebugGraphicsComponent.js.map +1 -0
- package/build/dist/Graphics/Filtering.js +17 -0
- package/build/dist/Graphics/Filtering.js.map +1 -0
- package/build/dist/Graphics/Font.js +148 -0
- package/build/dist/Graphics/Font.js.map +1 -0
- package/build/dist/Graphics/FontCache.d.ts +1 -0
- package/build/dist/Graphics/FontCache.js +80 -0
- package/build/dist/Graphics/FontCache.js.map +1 -0
- package/build/dist/Graphics/FontCommon.js +109 -0
- package/build/dist/Graphics/FontCommon.js.map +1 -0
- package/build/dist/Graphics/FontTextInstance.js +230 -0
- package/build/dist/Graphics/FontTextInstance.js.map +1 -0
- package/build/dist/Graphics/Graphic.js +208 -0
- package/build/dist/Graphics/Graphic.js.map +1 -0
- package/build/dist/Graphics/GraphicsComponent.js +336 -0
- package/build/dist/Graphics/GraphicsComponent.js.map +1 -0
- package/build/dist/Graphics/GraphicsDiagnostics.js +9 -0
- package/build/dist/Graphics/GraphicsDiagnostics.js.map +1 -0
- package/build/dist/Graphics/GraphicsGroup.js +69 -0
- package/build/dist/Graphics/GraphicsGroup.js.map +1 -0
- package/build/dist/Graphics/GraphicsSystem.js +210 -0
- package/build/dist/Graphics/GraphicsSystem.js.map +1 -0
- package/build/dist/Graphics/ImageSource.js +124 -0
- package/build/dist/Graphics/ImageSource.js.map +1 -0
- package/build/dist/Graphics/Line.js +45 -0
- package/build/dist/Graphics/Line.js.map +1 -0
- package/build/dist/Graphics/OffscreenSystem.js +64 -0
- package/build/dist/Graphics/OffscreenSystem.js.map +1 -0
- package/build/dist/Graphics/ParallaxComponent.js +11 -0
- package/build/dist/Graphics/ParallaxComponent.js.map +1 -0
- package/build/dist/Graphics/Polygon.js +59 -0
- package/build/dist/Graphics/Polygon.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js +7 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js +52 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/PostProcessor.js +2 -0
- package/build/dist/Graphics/PostProcessor/PostProcessor.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ScreenShader.js +59 -0
- package/build/dist/Graphics/PostProcessor/ScreenShader.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/color-blind-fragment.glsl +64 -64
- package/build/dist/Graphics/Raster.js +215 -0
- package/build/dist/Graphics/Raster.js.map +1 -0
- package/build/dist/Graphics/Rectangle.js +29 -0
- package/build/dist/Graphics/Rectangle.js.map +1 -0
- package/build/dist/Graphics/Sprite.js +82 -0
- package/build/dist/Graphics/Sprite.js.map +1 -0
- package/build/dist/Graphics/SpriteFont.js +139 -0
- package/build/dist/Graphics/SpriteFont.js.map +1 -0
- package/build/dist/Graphics/SpriteSheet.js +116 -0
- package/build/dist/Graphics/SpriteSheet.js.map +1 -0
- package/build/dist/Graphics/Text.js +103 -0
- package/build/dist/Graphics/Text.js.map +1 -0
- package/build/dist/Graphics/index.js +46 -0
- package/build/dist/Graphics/index.js.map +1 -0
- package/build/dist/Id.js +8 -0
- package/build/dist/Id.js.map +1 -0
- package/build/dist/Input/CapturePointerConfig.js +5 -0
- package/build/dist/Input/CapturePointerConfig.js.map +1 -0
- package/build/dist/Input/EngineInput.js +2 -0
- package/build/dist/Input/EngineInput.js.map +1 -0
- package/build/dist/Input/Gamepad.js +422 -0
- package/build/dist/Input/Gamepad.js.map +1 -0
- package/build/dist/Input/Index.js +88 -0
- package/build/dist/Input/Index.js.map +1 -0
- package/build/dist/Input/InputMapper.js +45 -0
- package/build/dist/Input/InputMapper.js.map +1 -0
- package/build/dist/Input/Keyboard.js +348 -0
- package/build/dist/Input/Keyboard.js.map +1 -0
- package/build/dist/Input/NativePointerButton.js +12 -0
- package/build/dist/Input/NativePointerButton.js.map +1 -0
- package/build/dist/Input/PointerAbstraction.js +44 -0
- package/build/dist/Input/PointerAbstraction.js.map +1 -0
- package/build/dist/Input/PointerButton.js +12 -0
- package/build/dist/Input/PointerButton.js.map +1 -0
- package/build/dist/Input/PointerComponent.js +28 -0
- package/build/dist/Input/PointerComponent.js.map +1 -0
- package/build/dist/Input/PointerEvent.js +25 -0
- package/build/dist/Input/PointerEvent.js.map +1 -0
- package/build/dist/Input/PointerEventReceiver.js +456 -0
- package/build/dist/Input/PointerEventReceiver.js.map +1 -0
- package/build/dist/Input/PointerScope.js +16 -0
- package/build/dist/Input/PointerScope.js.map +1 -0
- package/build/dist/Input/PointerSystem.js +249 -0
- package/build/dist/Input/PointerSystem.js.map +1 -0
- package/build/dist/Input/PointerType.js +11 -0
- package/build/dist/Input/PointerType.js.map +1 -0
- package/build/dist/Input/WheelDeltaMode.js +7 -0
- package/build/dist/Input/WheelDeltaMode.js.map +1 -0
- package/build/dist/Input/WheelEvent.js +21 -0
- package/build/dist/Input/WheelEvent.js.map +1 -0
- package/build/dist/Interfaces/Audio.js +2 -0
- package/build/dist/Interfaces/Audio.js.map +1 -0
- package/build/dist/Interfaces/AudioImplementation.js +11 -0
- package/build/dist/Interfaces/AudioImplementation.js.map +1 -0
- package/build/dist/Interfaces/Clonable.js +2 -0
- package/build/dist/Interfaces/Clonable.js.map +1 -0
- package/build/dist/Interfaces/Evented.js +2 -0
- package/build/dist/Interfaces/Evented.js.map +1 -0
- package/build/dist/Interfaces/Index.js +8 -0
- package/build/dist/Interfaces/Index.js.map +1 -0
- package/build/dist/Interfaces/LifecycleEvents.js +51 -0
- package/build/dist/Interfaces/LifecycleEvents.js.map +1 -0
- package/build/dist/Interfaces/Loadable.js +2 -0
- package/build/dist/Interfaces/Loadable.js.map +1 -0
- package/build/dist/Interfaces/PointerEventHandlers.js +2 -0
- package/build/dist/Interfaces/PointerEventHandlers.js.map +1 -0
- package/build/dist/Label.js +81 -0
- package/build/dist/Label.js.map +1 -0
- package/build/dist/Loader.js +416 -0
- package/build/dist/Loader.js.map +1 -0
- package/build/dist/Math/Index.js +13 -0
- package/build/dist/Math/Index.js.map +1 -0
- package/build/dist/Math/Random.js +239 -0
- package/build/dist/Math/Random.js.map +1 -0
- package/build/dist/Math/affine-matrix.js +331 -0
- package/build/dist/Math/affine-matrix.js.map +1 -0
- package/build/dist/Math/coord-plane.js +17 -0
- package/build/dist/Math/coord-plane.js.map +1 -0
- package/build/dist/Math/global-coordinates.js +30 -0
- package/build/dist/Math/global-coordinates.js.map +1 -0
- package/build/dist/Math/line-segment.js +205 -0
- package/build/dist/Math/line-segment.js.map +1 -0
- package/build/dist/Math/matrix.js +457 -0
- package/build/dist/Math/matrix.js.map +1 -0
- package/build/dist/Math/projection.js +24 -0
- package/build/dist/Math/projection.js.map +1 -0
- package/build/dist/Math/ray.js +52 -0
- package/build/dist/Math/ray.js.map +1 -0
- package/build/dist/Math/transform.js +219 -0
- package/build/dist/Math/transform.js.map +1 -0
- package/build/dist/Math/util.js +82 -0
- package/build/dist/Math/util.js.map +1 -0
- package/build/dist/Math/vector-view.js +25 -0
- package/build/dist/Math/vector-view.js.map +1 -0
- package/build/dist/Math/vector.js +340 -0
- package/build/dist/Math/vector.js.map +1 -0
- package/build/dist/Math/watch-vector.js +26 -0
- package/build/dist/Math/watch-vector.js.map +1 -0
- package/build/dist/Particles.js +430 -0
- package/build/dist/Particles.js.map +1 -0
- package/build/dist/Polyfill.js +56 -0
- package/build/dist/Polyfill.js.map +1 -0
- package/build/dist/Resources/Gif.js +464 -0
- package/build/dist/Resources/Gif.js.map +1 -0
- package/build/dist/Resources/Index.js +4 -0
- package/build/dist/Resources/Index.js.map +1 -0
- package/build/dist/Resources/Resource.js +81 -0
- package/build/dist/Resources/Resource.js.map +1 -0
- package/build/dist/Resources/Sound/AudioContext.js +16 -0
- package/build/dist/Resources/Sound/AudioContext.js.map +1 -0
- package/build/dist/Resources/Sound/Index.js +4 -0
- package/build/dist/Resources/Sound/Index.js.map +1 -0
- package/build/dist/Resources/Sound/Sound.js +326 -0
- package/build/dist/Resources/Sound/Sound.js.map +1 -0
- package/build/dist/Resources/Sound/WebAudioInstance.js +190 -0
- package/build/dist/Resources/Sound/WebAudioInstance.js.map +1 -0
- package/build/dist/Scene.js +444 -0
- package/build/dist/Scene.js.map +1 -0
- package/build/dist/Screen.js +782 -0
- package/build/dist/Screen.js.map +1 -0
- package/build/dist/ScreenElement.js +43 -0
- package/build/dist/ScreenElement.js.map +1 -0
- package/build/dist/TileMap/IsometricEntityComponent.js +17 -0
- package/build/dist/TileMap/IsometricEntityComponent.js.map +1 -0
- package/build/dist/TileMap/IsometricEntitySystem.js +23 -0
- package/build/dist/TileMap/IsometricEntitySystem.js.map +1 -0
- package/build/dist/TileMap/IsometricMap.js +311 -0
- package/build/dist/TileMap/IsometricMap.js.map +1 -0
- package/build/dist/TileMap/TileMap.d.ts +2 -1
- package/build/dist/TileMap/TileMap.js +630 -0
- package/build/dist/TileMap/TileMap.js.map +1 -0
- package/build/dist/TileMap/index.js +5 -0
- package/build/dist/TileMap/index.js.map +1 -0
- package/build/dist/Timer.js +202 -0
- package/build/dist/Timer.js.map +1 -0
- package/build/dist/Trigger.js +94 -0
- package/build/dist/Trigger.js.map +1 -0
- package/build/dist/Util/Browser.js +66 -0
- package/build/dist/Util/Browser.js.map +1 -0
- package/build/dist/Util/Clock.js +219 -0
- package/build/dist/Util/Clock.js.map +1 -0
- package/build/dist/Util/Decorators.js +78 -0
- package/build/dist/Util/Decorators.js.map +1 -0
- package/build/dist/Util/Detector.js +167 -0
- package/build/dist/Util/Detector.js.map +1 -0
- package/build/dist/Util/DrawUtil.js +115 -0
- package/build/dist/Util/DrawUtil.js.map +1 -0
- package/build/dist/Util/EasingFunctions.js +102 -0
- package/build/dist/Util/EasingFunctions.js.map +1 -0
- package/build/dist/Util/Fps.js +47 -0
- package/build/dist/Util/Fps.js.map +1 -0
- package/build/dist/Util/Future.js +30 -0
- package/build/dist/Util/Future.js.map +1 -0
- package/build/dist/Util/IFrame.js +23 -0
- package/build/dist/Util/IFrame.js.map +1 -0
- package/build/dist/Util/Index.js +7 -0
- package/build/dist/Util/Index.js.map +1 -0
- package/build/dist/Util/Log.js +195 -0
- package/build/dist/Util/Log.js.map +1 -0
- package/build/dist/Util/Observable.js +66 -0
- package/build/dist/Util/Observable.js.map +1 -0
- package/build/dist/Util/Pool.js +74 -0
- package/build/dist/Util/Pool.js.map +1 -0
- package/build/dist/Util/Semaphore.js +55 -0
- package/build/dist/Util/Semaphore.js.map +1 -0
- package/build/dist/Util/Sound.js +22 -0
- package/build/dist/Util/Sound.js.map +1 -0
- package/build/dist/Util/StateMachine.js +79 -0
- package/build/dist/Util/StateMachine.js.map +1 -0
- package/build/dist/Util/Toaster.css +28 -28
- package/build/dist/Util/Toaster.js +84 -0
- package/build/dist/Util/Toaster.js.map +1 -0
- package/build/dist/Util/Util.d.ts +6 -0
- package/build/dist/Util/Util.js +95 -0
- package/build/dist/Util/Util.js.map +1 -0
- package/build/dist/Util/Watch.js +67 -0
- package/build/dist/Util/Watch.js.map +1 -0
- package/build/dist/Util/WebAudio.js +62 -0
- package/build/dist/Util/WebAudio.js.map +1 -0
- package/build/dist/excalibur.d.ts +2 -2
- package/build/dist/excalibur.js +389 -258
- 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/dist/index.js +81 -0
- package/build/dist/index.js.map +1 -0
- package/build/esm/Debug/Debug.d.ts +11 -0
- package/build/esm/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +1 -0
- package/build/esm/Graphics/Context/material.d.ts +2 -0
- package/build/esm/Graphics/DebugGraphicsComponent.d.ts +3 -2
- package/build/esm/Graphics/FontCache.d.ts +1 -0
- package/build/esm/TileMap/TileMap.d.ts +2 -1
- package/build/esm/Util/Util.d.ts +6 -0
- package/build/esm/excalibur.d.ts +2 -2
- package/build/esm/excalibur.js +389 -258
- package/build/esm/excalibur.js.map +1 -1
- package/build/esm/excalibur.min.js +1 -1
- package/build/esm/excalibur.min.js.LICENSE.txt +1 -1
- package/build/esm/excalibur.min.js.map +1 -1
- package/docker-compose.yml +11 -11
- package/package.json +131 -131
- package/build/dist/Loader.css +0 -122
- package/build/nuget/Excalibur.0.28.3.nupkg +0 -0
- package/build/v0.28.3.zip +0 -0
- package/excalibur-0.28.3.tgz +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from './ActionContext';
|
|
2
|
+
export * from './ActionQueue';
|
|
3
|
+
export * from './Actionable';
|
|
4
|
+
export * from './RotationType';
|
|
5
|
+
export * from './Action';
|
|
6
|
+
export * from './Action/ActionSequence';
|
|
7
|
+
export * from './Action/ParallelActions';
|
|
8
|
+
export * from './Action/Repeat';
|
|
9
|
+
export * from './Action/RepeatForever';
|
|
10
|
+
export * from './Action/Blink';
|
|
11
|
+
export * from './Action/Die';
|
|
12
|
+
export * from './Action/EaseTo';
|
|
13
|
+
export * from './Action/EaseBy';
|
|
14
|
+
export * from './Action/Fade';
|
|
15
|
+
export * from './Action/Follow';
|
|
16
|
+
export * from './Action/Meet';
|
|
17
|
+
export * from './Action/MoveBy';
|
|
18
|
+
export * from './Action/MoveTo';
|
|
19
|
+
export * from './Action/RotateBy';
|
|
20
|
+
export * from './Action/RotateTo';
|
|
21
|
+
export * from './Action/ScaleBy';
|
|
22
|
+
export * from './Action/ScaleTo';
|
|
23
|
+
export * from './Action/Delay';
|
|
24
|
+
export * from './ActionsComponent';
|
|
25
|
+
export * from './ActionsSystem';
|
|
26
|
+
//# sourceMappingURL=Index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Index.js","sourceRoot":"","sources":["../../../src/engine/Actions/Index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An enum that describes the strategies that rotation actions can use
|
|
3
|
+
*/
|
|
4
|
+
export var RotationType;
|
|
5
|
+
(function (RotationType) {
|
|
6
|
+
/**
|
|
7
|
+
* Rotation via `ShortestPath` will use the smallest angle
|
|
8
|
+
* between the starting and ending points. This strategy is the default behavior.
|
|
9
|
+
*/
|
|
10
|
+
RotationType[RotationType["ShortestPath"] = 0] = "ShortestPath";
|
|
11
|
+
/**
|
|
12
|
+
* Rotation via `LongestPath` will use the largest angle
|
|
13
|
+
* between the starting and ending points.
|
|
14
|
+
*/
|
|
15
|
+
RotationType[RotationType["LongestPath"] = 1] = "LongestPath";
|
|
16
|
+
/**
|
|
17
|
+
* Rotation via `Clockwise` will travel in a clockwise direction,
|
|
18
|
+
* regardless of the starting and ending points.
|
|
19
|
+
*/
|
|
20
|
+
RotationType[RotationType["Clockwise"] = 2] = "Clockwise";
|
|
21
|
+
/**
|
|
22
|
+
* Rotation via `CounterClockwise` will travel in a counterclockwise direction,
|
|
23
|
+
* regardless of the starting and ending points.
|
|
24
|
+
*/
|
|
25
|
+
RotationType[RotationType["CounterClockwise"] = 3] = "CounterClockwise";
|
|
26
|
+
})(RotationType || (RotationType = {}));
|
|
27
|
+
//# sourceMappingURL=RotationType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RotationType.js","sourceRoot":"","sources":["../../../src/engine/Actions/RotationType.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,YAqBX;AArBD,WAAY,YAAY;IACtB;;;OAGG;IACH,+DAAgB,CAAA;IAChB;;;OAGG;IACH,6DAAe,CAAA;IACf;;;OAGG;IACH,yDAAa,CAAA;IACb;;;OAGG;IACH,uEAAoB,CAAA;AACtB,CAAC,EArBW,YAAY,KAAZ,YAAY,QAqBvB"}
|
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
import { KillEvent, PreUpdateEvent, PostUpdateEvent, PostKillEvent, PreKillEvent } from './Events';
|
|
2
|
+
import { Logger } from './Util/Log';
|
|
3
|
+
import { Vector, vec } from './Math/vector';
|
|
4
|
+
import { BodyComponent } from './Collision/BodyComponent';
|
|
5
|
+
import { CollisionType } from './Collision/CollisionType';
|
|
6
|
+
import { Entity } from './EntityComponentSystem/Entity';
|
|
7
|
+
import { TransformComponent } from './EntityComponentSystem/Components/TransformComponent';
|
|
8
|
+
import { MotionComponent } from './EntityComponentSystem/Components/MotionComponent';
|
|
9
|
+
import { GraphicsComponent } from './Graphics/GraphicsComponent';
|
|
10
|
+
import { Rectangle } from './Graphics/Rectangle';
|
|
11
|
+
import { ColliderComponent } from './Collision/ColliderComponent';
|
|
12
|
+
import { Shape } from './Collision/Colliders/Shape';
|
|
13
|
+
import { watch } from './Util/Watch';
|
|
14
|
+
import { Circle } from './Graphics/Circle';
|
|
15
|
+
import { PointerComponent } from './Input/PointerComponent';
|
|
16
|
+
import { ActionsComponent } from './Actions/ActionsComponent';
|
|
17
|
+
import { Raster } from './Graphics/Raster';
|
|
18
|
+
import { Text } from './Graphics/Text';
|
|
19
|
+
import { CoordPlane } from './Math/coord-plane';
|
|
20
|
+
import { EventEmitter } from './EventEmitter';
|
|
21
|
+
/**
|
|
22
|
+
* Type guard for checking if something is an Actor
|
|
23
|
+
* @param x
|
|
24
|
+
*/
|
|
25
|
+
export function isActor(x) {
|
|
26
|
+
return x instanceof Actor;
|
|
27
|
+
}
|
|
28
|
+
export const ActorEvents = {
|
|
29
|
+
CollisionStart: 'collisionstart',
|
|
30
|
+
CollisionEnd: 'collisionend',
|
|
31
|
+
PreCollision: 'precollision',
|
|
32
|
+
PostCollision: 'postcollision',
|
|
33
|
+
Kill: 'kill',
|
|
34
|
+
PreKill: 'prekill',
|
|
35
|
+
PostKill: 'postkill',
|
|
36
|
+
PreDraw: 'predraw',
|
|
37
|
+
PostDraw: 'postdraw',
|
|
38
|
+
PreDebugDraw: 'predebugdraw',
|
|
39
|
+
PostDebugDraw: 'postdebugdraw',
|
|
40
|
+
PointerUp: 'pointerup',
|
|
41
|
+
PointerDown: 'pointerdown',
|
|
42
|
+
PointerEnter: 'pointerenter',
|
|
43
|
+
PointerLeave: 'pointerleave',
|
|
44
|
+
PointerMove: 'pointermove',
|
|
45
|
+
PointerCancel: 'pointercancel',
|
|
46
|
+
Wheel: 'pointerwheel',
|
|
47
|
+
PointerDrag: 'pointerdragstart',
|
|
48
|
+
PointerDragEnd: 'pointerdragend',
|
|
49
|
+
PointerDragEnter: 'pointerdragenter',
|
|
50
|
+
PointerDragLeave: 'pointerdragleave',
|
|
51
|
+
PointerDragMove: 'pointerdragmove',
|
|
52
|
+
EnterViewPort: 'enterviewport',
|
|
53
|
+
ExitViewPort: 'exitviewport'
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The most important primitive in Excalibur is an `Actor`. Anything that
|
|
57
|
+
* can move on the screen, collide with another `Actor`, respond to events,
|
|
58
|
+
* or interact with the current scene, must be an actor. An `Actor` **must**
|
|
59
|
+
* be part of a [[Scene]] for it to be drawn to the screen.
|
|
60
|
+
*/
|
|
61
|
+
export class Actor extends Entity {
|
|
62
|
+
/**
|
|
63
|
+
* The physics body the is associated with this actor. The body is the container for all physical properties, like position, velocity,
|
|
64
|
+
* acceleration, mass, inertia, etc.
|
|
65
|
+
*/
|
|
66
|
+
get body() {
|
|
67
|
+
return this.get(BodyComponent);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Access the Actor's built in [[TransformComponent]]
|
|
71
|
+
*/
|
|
72
|
+
get transform() {
|
|
73
|
+
return this.get(TransformComponent);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Access the Actor's built in [[MotionComponent]]
|
|
77
|
+
*/
|
|
78
|
+
get motion() {
|
|
79
|
+
return this.get(MotionComponent);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Access to the Actor's built in [[GraphicsComponent]]
|
|
83
|
+
*/
|
|
84
|
+
get graphics() {
|
|
85
|
+
return this.get(GraphicsComponent);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Access to the Actor's built in [[ColliderComponent]]
|
|
89
|
+
*/
|
|
90
|
+
get collider() {
|
|
91
|
+
return this.get(ColliderComponent);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Access to the Actor's built in [[PointerComponent]] config
|
|
95
|
+
*/
|
|
96
|
+
get pointer() {
|
|
97
|
+
return this.get(PointerComponent);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Useful for quickly scripting actor behavior, like moving to a place, patrolling back and forth, blinking, etc.
|
|
101
|
+
*
|
|
102
|
+
* Access to the Actor's built in [[ActionsComponent]] which forwards to the
|
|
103
|
+
* [[ActionContext|Action context]] of the actor.
|
|
104
|
+
*/
|
|
105
|
+
get actions() {
|
|
106
|
+
return this.get(ActionsComponent);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Gets the position vector of the actor in pixels
|
|
110
|
+
*/
|
|
111
|
+
get pos() {
|
|
112
|
+
return this.transform.pos;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Sets the position vector of the actor in pixels
|
|
116
|
+
*/
|
|
117
|
+
set pos(thePos) {
|
|
118
|
+
this.transform.pos = thePos.clone();
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Gets the position vector of the actor from the last frame
|
|
122
|
+
*/
|
|
123
|
+
get oldPos() {
|
|
124
|
+
return this.body.oldPos;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Sets the position vector of the actor in the last frame
|
|
128
|
+
*/
|
|
129
|
+
set oldPos(thePos) {
|
|
130
|
+
this.body.oldPos.setTo(thePos.x, thePos.y);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Gets the velocity vector of the actor in pixels/sec
|
|
134
|
+
*/
|
|
135
|
+
get vel() {
|
|
136
|
+
return this.motion.vel;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Sets the velocity vector of the actor in pixels/sec
|
|
140
|
+
*/
|
|
141
|
+
set vel(theVel) {
|
|
142
|
+
this.motion.vel = theVel.clone();
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Gets the velocity vector of the actor from the last frame
|
|
146
|
+
*/
|
|
147
|
+
get oldVel() {
|
|
148
|
+
return this.body.oldVel;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Sets the velocity vector of the actor from the last frame
|
|
152
|
+
*/
|
|
153
|
+
set oldVel(theVel) {
|
|
154
|
+
this.body.oldVel.setTo(theVel.x, theVel.y);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Gets the acceleration vector of the actor in pixels/second/second. An acceleration pointing down such as (0, 100) may be
|
|
158
|
+
* useful to simulate a gravitational effect.
|
|
159
|
+
*/
|
|
160
|
+
get acc() {
|
|
161
|
+
return this.motion.acc;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Sets the acceleration vector of teh actor in pixels/second/second
|
|
165
|
+
*/
|
|
166
|
+
set acc(theAcc) {
|
|
167
|
+
this.motion.acc = theAcc.clone();
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Sets the acceleration of the actor from the last frame. This does not include the global acc [[Physics.acc]].
|
|
171
|
+
*/
|
|
172
|
+
set oldAcc(theAcc) {
|
|
173
|
+
this.body.oldAcc.setTo(theAcc.x, theAcc.y);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Gets the acceleration of the actor from the last frame. This does not include the global acc [[Physics.acc]].
|
|
177
|
+
*/
|
|
178
|
+
get oldAcc() {
|
|
179
|
+
return this.body.oldAcc;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Gets the rotation of the actor in radians. 1 radian = 180/PI Degrees.
|
|
183
|
+
*/
|
|
184
|
+
get rotation() {
|
|
185
|
+
return this.transform.rotation;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Sets the rotation of the actor in radians. 1 radian = 180/PI Degrees.
|
|
189
|
+
*/
|
|
190
|
+
set rotation(theAngle) {
|
|
191
|
+
this.transform.rotation = theAngle;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Gets the rotational velocity of the actor in radians/second
|
|
195
|
+
*/
|
|
196
|
+
get angularVelocity() {
|
|
197
|
+
return this.motion.angularVelocity;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Sets the rotational velocity of the actor in radians/sec
|
|
201
|
+
*/
|
|
202
|
+
set angularVelocity(angularVelocity) {
|
|
203
|
+
this.motion.angularVelocity = angularVelocity;
|
|
204
|
+
}
|
|
205
|
+
get scale() {
|
|
206
|
+
return this.get(TransformComponent).scale;
|
|
207
|
+
}
|
|
208
|
+
set scale(scale) {
|
|
209
|
+
this.get(TransformComponent).scale = scale;
|
|
210
|
+
}
|
|
211
|
+
get anchor() {
|
|
212
|
+
return this._anchor;
|
|
213
|
+
}
|
|
214
|
+
set anchor(vec) {
|
|
215
|
+
this._anchor = watch(vec, (v) => this._handleAnchorChange(v));
|
|
216
|
+
this._handleAnchorChange(vec);
|
|
217
|
+
}
|
|
218
|
+
_handleAnchorChange(v) {
|
|
219
|
+
if (this.graphics) {
|
|
220
|
+
this.graphics.anchor = v;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Indicates whether the actor is physically in the viewport
|
|
225
|
+
*/
|
|
226
|
+
get isOffScreen() {
|
|
227
|
+
return this.hasTag('ex.offscreen');
|
|
228
|
+
}
|
|
229
|
+
get draggable() {
|
|
230
|
+
return this._draggable;
|
|
231
|
+
}
|
|
232
|
+
set draggable(isDraggable) {
|
|
233
|
+
if (isDraggable) {
|
|
234
|
+
if (isDraggable && !this._draggable) {
|
|
235
|
+
this.events.on('pointerdragstart', this._pointerDragStartHandler);
|
|
236
|
+
this.events.on('pointerdragend', this._pointerDragEndHandler);
|
|
237
|
+
this.events.on('pointerdragmove', this._pointerDragMoveHandler);
|
|
238
|
+
this.events.on('pointerdragleave', this._pointerDragLeaveHandler);
|
|
239
|
+
}
|
|
240
|
+
else if (!isDraggable && this._draggable) {
|
|
241
|
+
this.events.off('pointerdragstart', this._pointerDragStartHandler);
|
|
242
|
+
this.events.off('pointerdragend', this._pointerDragEndHandler);
|
|
243
|
+
this.events.off('pointerdragmove', this._pointerDragMoveHandler);
|
|
244
|
+
this.events.off('pointerdragleave', this._pointerDragLeaveHandler);
|
|
245
|
+
}
|
|
246
|
+
this._draggable = isDraggable;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Sets the color of the actor's current graphic
|
|
251
|
+
*/
|
|
252
|
+
get color() {
|
|
253
|
+
return this._color;
|
|
254
|
+
}
|
|
255
|
+
set color(v) {
|
|
256
|
+
var _a;
|
|
257
|
+
this._color = v.clone();
|
|
258
|
+
const defaultLayer = this.graphics.layers.default;
|
|
259
|
+
const currentGraphic = (_a = defaultLayer.graphics[0]) === null || _a === void 0 ? void 0 : _a.graphic;
|
|
260
|
+
if (currentGraphic instanceof Raster || currentGraphic instanceof Text) {
|
|
261
|
+
currentGraphic.color = this._color;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
// #endregion
|
|
265
|
+
/**
|
|
266
|
+
*
|
|
267
|
+
* @param config
|
|
268
|
+
*/
|
|
269
|
+
constructor(config) {
|
|
270
|
+
super();
|
|
271
|
+
this.events = new EventEmitter();
|
|
272
|
+
/**
|
|
273
|
+
* The anchor to apply all actor related transformations like rotation,
|
|
274
|
+
* translation, and scaling. By default the anchor is in the center of
|
|
275
|
+
* the actor. By default it is set to the center of the actor (.5, .5)
|
|
276
|
+
*
|
|
277
|
+
* An anchor of (.5, .5) will ensure that drawings are centered.
|
|
278
|
+
*
|
|
279
|
+
* Use `anchor.setTo` to set the anchor to a different point using
|
|
280
|
+
* values between 0 and 1. For example, anchoring to the top-left would be
|
|
281
|
+
* `Actor.anchor.setTo(0, 0)` and top-right would be `Actor.anchor.setTo(0, 1)`.
|
|
282
|
+
*/
|
|
283
|
+
this._anchor = watch(Vector.Half, (v) => this._handleAnchorChange(v));
|
|
284
|
+
/**
|
|
285
|
+
* Convenience reference to the global logger
|
|
286
|
+
*/
|
|
287
|
+
this.logger = Logger.getInstance();
|
|
288
|
+
/**
|
|
289
|
+
* Draggable helper
|
|
290
|
+
*/
|
|
291
|
+
this._draggable = false;
|
|
292
|
+
this._dragging = false;
|
|
293
|
+
this._pointerDragStartHandler = () => {
|
|
294
|
+
this._dragging = true;
|
|
295
|
+
};
|
|
296
|
+
this._pointerDragEndHandler = () => {
|
|
297
|
+
this._dragging = false;
|
|
298
|
+
};
|
|
299
|
+
this._pointerDragMoveHandler = (pe) => {
|
|
300
|
+
if (this._dragging) {
|
|
301
|
+
this.pos = pe.worldPos;
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
this._pointerDragLeaveHandler = (pe) => {
|
|
305
|
+
if (this._dragging) {
|
|
306
|
+
this.pos = pe.worldPos;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
const { name, x, y, pos, coordPlane, scale, width, height, radius, collider, vel, acc, rotation, angularVelocity, z, color, visible, anchor, collisionType, collisionGroup } = {
|
|
310
|
+
...config
|
|
311
|
+
};
|
|
312
|
+
this._setName(name);
|
|
313
|
+
this.anchor = anchor !== null && anchor !== void 0 ? anchor : Actor.defaults.anchor.clone();
|
|
314
|
+
const tx = new TransformComponent();
|
|
315
|
+
this.addComponent(tx);
|
|
316
|
+
this.pos = pos !== null && pos !== void 0 ? pos : vec(x !== null && x !== void 0 ? x : 0, y !== null && y !== void 0 ? y : 0);
|
|
317
|
+
this.rotation = rotation !== null && rotation !== void 0 ? rotation : 0;
|
|
318
|
+
this.scale = scale !== null && scale !== void 0 ? scale : vec(1, 1);
|
|
319
|
+
this.z = z !== null && z !== void 0 ? z : 0;
|
|
320
|
+
tx.coordPlane = coordPlane !== null && coordPlane !== void 0 ? coordPlane : CoordPlane.World;
|
|
321
|
+
this.addComponent(new PointerComponent);
|
|
322
|
+
this.addComponent(new GraphicsComponent({
|
|
323
|
+
anchor: this.anchor
|
|
324
|
+
}));
|
|
325
|
+
this.addComponent(new MotionComponent());
|
|
326
|
+
this.vel = vel !== null && vel !== void 0 ? vel : Vector.Zero;
|
|
327
|
+
this.acc = acc !== null && acc !== void 0 ? acc : Vector.Zero;
|
|
328
|
+
this.angularVelocity = angularVelocity !== null && angularVelocity !== void 0 ? angularVelocity : 0;
|
|
329
|
+
this.addComponent(new ActionsComponent());
|
|
330
|
+
this.addComponent(new BodyComponent());
|
|
331
|
+
this.body.collisionType = collisionType !== null && collisionType !== void 0 ? collisionType : CollisionType.Passive;
|
|
332
|
+
if (collisionGroup) {
|
|
333
|
+
this.body.group = collisionGroup;
|
|
334
|
+
}
|
|
335
|
+
if (collider) {
|
|
336
|
+
this.addComponent(new ColliderComponent(collider));
|
|
337
|
+
}
|
|
338
|
+
else if (radius) {
|
|
339
|
+
this.addComponent(new ColliderComponent(Shape.Circle(radius)));
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
if (width > 0 && height > 0) {
|
|
343
|
+
this.addComponent(new ColliderComponent(Shape.Box(width, height, this.anchor)));
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
this.addComponent(new ColliderComponent()); // no collider
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
this.graphics.visible = visible !== null && visible !== void 0 ? visible : true;
|
|
350
|
+
if (color) {
|
|
351
|
+
this.color = color;
|
|
352
|
+
if (width && height) {
|
|
353
|
+
this.graphics.add(new Rectangle({
|
|
354
|
+
color: color,
|
|
355
|
+
width,
|
|
356
|
+
height
|
|
357
|
+
}));
|
|
358
|
+
}
|
|
359
|
+
else if (radius) {
|
|
360
|
+
this.graphics.add(new Circle({
|
|
361
|
+
color: color,
|
|
362
|
+
radius
|
|
363
|
+
}));
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
clone() {
|
|
368
|
+
const clone = new Actor({
|
|
369
|
+
color: this.color.clone(),
|
|
370
|
+
anchor: this.anchor.clone()
|
|
371
|
+
});
|
|
372
|
+
clone.clearComponents();
|
|
373
|
+
clone.processComponentRemoval();
|
|
374
|
+
// Clone the current actors components
|
|
375
|
+
const components = this.getComponents();
|
|
376
|
+
for (const c of components) {
|
|
377
|
+
clone.addComponent(c.clone(), true);
|
|
378
|
+
}
|
|
379
|
+
return clone;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* `onInitialize` is called before the first update of the actor. This method is meant to be
|
|
383
|
+
* overridden. This is where initialization of child actors should take place.
|
|
384
|
+
*
|
|
385
|
+
* Synonymous with the event handler `.on('initialize', (evt) => {...})`
|
|
386
|
+
*/
|
|
387
|
+
onInitialize(_engine) {
|
|
388
|
+
// Override me
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Initializes this actor and all it's child actors, meant to be called by the Scene before first update not by users of Excalibur.
|
|
392
|
+
*
|
|
393
|
+
* It is not recommended that internal excalibur methods be overridden, do so at your own risk.
|
|
394
|
+
* @internal
|
|
395
|
+
*/
|
|
396
|
+
_initialize(engine) {
|
|
397
|
+
super._initialize(engine);
|
|
398
|
+
for (const child of this.children) {
|
|
399
|
+
child._initialize(engine);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
emit(eventName, event) {
|
|
403
|
+
this.events.emit(eventName, event);
|
|
404
|
+
}
|
|
405
|
+
on(eventName, handler) {
|
|
406
|
+
return this.events.on(eventName, handler);
|
|
407
|
+
}
|
|
408
|
+
once(eventName, handler) {
|
|
409
|
+
return this.events.once(eventName, handler);
|
|
410
|
+
}
|
|
411
|
+
off(eventName, handler) {
|
|
412
|
+
this.events.off(eventName, handler);
|
|
413
|
+
}
|
|
414
|
+
// #endregion
|
|
415
|
+
/**
|
|
416
|
+
* It is not recommended that internal excalibur methods be overridden, do so at your own risk.
|
|
417
|
+
*
|
|
418
|
+
* Internal _prekill handler for [[onPreKill]] lifecycle event
|
|
419
|
+
* @internal
|
|
420
|
+
*/
|
|
421
|
+
_prekill(_scene) {
|
|
422
|
+
this.events.emit('prekill', new PreKillEvent(this));
|
|
423
|
+
this.onPreKill(_scene);
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Safe to override onPreKill lifecycle event handler. Synonymous with `.on('prekill', (evt) =>{...})`
|
|
427
|
+
*
|
|
428
|
+
* `onPreKill` is called directly before an actor is killed and removed from its current [[Scene]].
|
|
429
|
+
*/
|
|
430
|
+
onPreKill(_scene) {
|
|
431
|
+
// Override me
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* It is not recommended that internal excalibur methods be overridden, do so at your own risk.
|
|
435
|
+
*
|
|
436
|
+
* Internal _prekill handler for [[onPostKill]] lifecycle event
|
|
437
|
+
* @internal
|
|
438
|
+
*/
|
|
439
|
+
_postkill(_scene) {
|
|
440
|
+
this.events.emit('postkill', new PostKillEvent(this));
|
|
441
|
+
this.onPostKill(_scene);
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Safe to override onPostKill lifecycle event handler. Synonymous with `.on('postkill', (evt) => {...})`
|
|
445
|
+
*
|
|
446
|
+
* `onPostKill` is called directly after an actor is killed and remove from its current [[Scene]].
|
|
447
|
+
*/
|
|
448
|
+
onPostKill(_scene) {
|
|
449
|
+
// Override me
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* If the current actor is a member of the scene, this will remove
|
|
453
|
+
* it from the scene graph. It will no longer be drawn or updated.
|
|
454
|
+
*/
|
|
455
|
+
kill() {
|
|
456
|
+
if (this.scene) {
|
|
457
|
+
this._prekill(this.scene);
|
|
458
|
+
this.events.emit('kill', new KillEvent(this));
|
|
459
|
+
super.kill();
|
|
460
|
+
this._postkill(this.scene);
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
this.logger.warn(`Cannot kill actor named "${this.name}", it was never added to the Scene`);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* If the current actor is killed, it will now not be killed.
|
|
468
|
+
*/
|
|
469
|
+
unkill() {
|
|
470
|
+
this.active = true;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Indicates wether the actor has been killed.
|
|
474
|
+
*/
|
|
475
|
+
isKilled() {
|
|
476
|
+
return !this.active;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Gets the z-index of an actor. The z-index determines the relative order an actor is drawn in.
|
|
480
|
+
* Actors with a higher z-index are drawn on top of actors with a lower z-index
|
|
481
|
+
*/
|
|
482
|
+
get z() {
|
|
483
|
+
return this.get(TransformComponent).z;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Sets the z-index of an actor and updates it in the drawing list for the scene.
|
|
487
|
+
* The z-index determines the relative order an actor is drawn in.
|
|
488
|
+
* Actors with a higher z-index are drawn on top of actors with a lower z-index
|
|
489
|
+
* @param newZ new z-index to assign
|
|
490
|
+
*/
|
|
491
|
+
set z(newZ) {
|
|
492
|
+
this.get(TransformComponent).z = newZ;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Get the center point of an actor (global position)
|
|
496
|
+
*/
|
|
497
|
+
get center() {
|
|
498
|
+
const globalPos = this.getGlobalPos();
|
|
499
|
+
return new Vector(globalPos.x + this.width / 2 - this.anchor.x * this.width, globalPos.y + this.height / 2 - this.anchor.y * this.height);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Get the local center point of an actor
|
|
503
|
+
*/
|
|
504
|
+
get localCenter() {
|
|
505
|
+
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);
|
|
506
|
+
}
|
|
507
|
+
get width() {
|
|
508
|
+
return this.collider.localBounds.width * this.getGlobalScale().x;
|
|
509
|
+
}
|
|
510
|
+
get height() {
|
|
511
|
+
return this.collider.localBounds.height * this.getGlobalScale().y;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Gets this actor's rotation taking into account any parent relationships
|
|
515
|
+
* @returns Rotation angle in radians
|
|
516
|
+
*/
|
|
517
|
+
getGlobalRotation() {
|
|
518
|
+
return this.get(TransformComponent).globalRotation;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Gets an actor's world position taking into account parent relationships, scaling, rotation, and translation
|
|
522
|
+
* @returns Position in world coordinates
|
|
523
|
+
*/
|
|
524
|
+
getGlobalPos() {
|
|
525
|
+
return this.get(TransformComponent).globalPos;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Gets the global scale of the Actor
|
|
529
|
+
*/
|
|
530
|
+
getGlobalScale() {
|
|
531
|
+
return this.get(TransformComponent).globalScale;
|
|
532
|
+
}
|
|
533
|
+
// #region Collision
|
|
534
|
+
/**
|
|
535
|
+
* Tests whether the x/y specified are contained in the actor
|
|
536
|
+
* @param x X coordinate to test (in world coordinates)
|
|
537
|
+
* @param y Y coordinate to test (in world coordinates)
|
|
538
|
+
* @param recurse checks whether the x/y are contained in any child actors (if they exist).
|
|
539
|
+
*/
|
|
540
|
+
contains(x, y, recurse = false) {
|
|
541
|
+
const point = vec(x, y);
|
|
542
|
+
const collider = this.get(ColliderComponent);
|
|
543
|
+
collider.update();
|
|
544
|
+
const geom = collider.get();
|
|
545
|
+
if (!geom) {
|
|
546
|
+
return false;
|
|
547
|
+
}
|
|
548
|
+
const containment = geom.contains(point);
|
|
549
|
+
if (recurse) {
|
|
550
|
+
return (containment ||
|
|
551
|
+
this.children.some((child) => {
|
|
552
|
+
return child.contains(x, y, true);
|
|
553
|
+
}));
|
|
554
|
+
}
|
|
555
|
+
return containment;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Returns true if the two actor.collider's surfaces are less than or equal to the distance specified from each other
|
|
559
|
+
* @param actor Actor to test
|
|
560
|
+
* @param distance Distance in pixels to test
|
|
561
|
+
*/
|
|
562
|
+
within(actor, distance) {
|
|
563
|
+
const collider = this.get(ColliderComponent);
|
|
564
|
+
const otherCollider = actor.get(ColliderComponent);
|
|
565
|
+
const me = collider.get();
|
|
566
|
+
const other = otherCollider.get();
|
|
567
|
+
if (me && other) {
|
|
568
|
+
return me.getClosestLineBetween(other).getLength() <= distance;
|
|
569
|
+
}
|
|
570
|
+
return false;
|
|
571
|
+
}
|
|
572
|
+
// #endregion
|
|
573
|
+
// #region Update
|
|
574
|
+
/**
|
|
575
|
+
* Called by the Engine, updates the state of the actor
|
|
576
|
+
* @internal
|
|
577
|
+
* @param engine The reference to the current game engine
|
|
578
|
+
* @param delta The time elapsed since the last update in milliseconds
|
|
579
|
+
*/
|
|
580
|
+
update(engine, delta) {
|
|
581
|
+
this._initialize(engine);
|
|
582
|
+
this._preupdate(engine, delta);
|
|
583
|
+
this._postupdate(engine, delta);
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Safe to override onPreUpdate lifecycle event handler. Synonymous with `.on('preupdate', (evt) =>{...})`
|
|
587
|
+
*
|
|
588
|
+
* `onPreUpdate` is called directly before an actor is updated.
|
|
589
|
+
*/
|
|
590
|
+
onPreUpdate(_engine, _delta) {
|
|
591
|
+
// Override me
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Safe to override onPostUpdate lifecycle event handler. Synonymous with `.on('postupdate', (evt) =>{...})`
|
|
595
|
+
*
|
|
596
|
+
* `onPostUpdate` is called directly after an actor is updated.
|
|
597
|
+
*/
|
|
598
|
+
onPostUpdate(_engine, _delta) {
|
|
599
|
+
// Override me
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* It is not recommended that internal excalibur methods be overridden, do so at your own risk.
|
|
603
|
+
*
|
|
604
|
+
* Internal _preupdate handler for [[onPreUpdate]] lifecycle event
|
|
605
|
+
* @internal
|
|
606
|
+
*/
|
|
607
|
+
_preupdate(engine, delta) {
|
|
608
|
+
this.events.emit('preupdate', new PreUpdateEvent(engine, delta, this));
|
|
609
|
+
this.onPreUpdate(engine, delta);
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* It is not recommended that internal excalibur methods be overridden, do so at your own risk.
|
|
613
|
+
*
|
|
614
|
+
* Internal _preupdate handler for [[onPostUpdate]] lifecycle event
|
|
615
|
+
* @internal
|
|
616
|
+
*/
|
|
617
|
+
_postupdate(engine, delta) {
|
|
618
|
+
this.events.emit('postupdate', new PostUpdateEvent(engine, delta, this));
|
|
619
|
+
this.onPostUpdate(engine, delta);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
// #region Properties
|
|
623
|
+
/**
|
|
624
|
+
* Set defaults for all Actors
|
|
625
|
+
*/
|
|
626
|
+
Actor.defaults = {
|
|
627
|
+
anchor: Vector.Half
|
|
628
|
+
};
|
|
629
|
+
//# sourceMappingURL=Actor.js.map
|