gdcore-tools 2.0.0-gd-v5.5.242-autobuild → 2.0.0-gd-v5.5.243-autobuild
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/dist/Runtime/AsyncTasksManager.js +2 -2
- package/dist/Runtime/AsyncTasksManager.js.map +2 -2
- package/dist/Runtime/CustomRuntimeObject.js +1 -1
- package/dist/Runtime/CustomRuntimeObject.js.map +2 -2
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js +1 -1
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js +1 -1
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js.map +2 -2
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js +1 -1
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js.map +2 -2
- package/dist/Runtime/Extensions/3D/JsExtension.js +5 -0
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js +1 -1
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js +1 -1
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js.map +2 -2
- package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/DebuggerTools/JsExtension.js +3 -1
- package/dist/Runtime/Extensions/DestroyOutsideBehavior/destroyoutsideruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/DestroyOutsideBehavior/destroyoutsideruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/messageManager.js +1 -1
- package/dist/Runtime/Extensions/Multiplayer/messageManager.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js +1 -1
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
- package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCar3DRuntimeBehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCar3DRuntimeBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/SaveState/JsExtension.js +488 -0
- package/dist/Runtime/Extensions/SaveState/SaveConfigurationRuntimeBehavior.js +2 -0
- package/dist/Runtime/Extensions/SaveState/SaveConfigurationRuntimeBehavior.js.map +7 -0
- package/dist/Runtime/Extensions/SaveState/SaveStateTools.js +2 -0
- package/dist/Runtime/Extensions/SaveState/SaveStateTools.js.map +7 -0
- package/dist/Runtime/Extensions/Spine/spineruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TextObject/textruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts +4 -4
- package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/TweenBehavior/TweenManager.js +2 -2
- package/dist/Runtime/Extensions/TweenBehavior/TweenManager.js.map +2 -2
- package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/TweenBehavior/tweentools.js +1 -1
- package/dist/Runtime/Extensions/TweenBehavior/tweentools.js.map +2 -2
- package/dist/Runtime/Extensions/Video/videoruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
- package/dist/Runtime/RuntimeInstanceContainer.js +1 -1
- package/dist/Runtime/RuntimeInstanceContainer.js.map +2 -2
- package/dist/Runtime/RuntimeLayer.js +1 -1
- package/dist/Runtime/RuntimeLayer.js.map +2 -2
- package/dist/Runtime/debugger-client/hot-reloader.js +1 -1
- package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
- package/dist/Runtime/events-tools/objecttools.js +1 -1
- package/dist/Runtime/events-tools/objecttools.js.map +2 -2
- package/dist/Runtime/events-tools/runtimescenetools.js +1 -1
- package/dist/Runtime/events-tools/runtimescenetools.js.map +2 -2
- package/dist/Runtime/gd.js +1 -1
- package/dist/Runtime/gd.js.map +2 -2
- package/dist/Runtime/howler-sound-manager/howler-sound-manager.js +1 -1
- package/dist/Runtime/howler-sound-manager/howler-sound-manager.js.map +2 -2
- package/dist/Runtime/indexeddb.js +2 -0
- package/dist/Runtime/indexeddb.js.map +7 -0
- package/dist/Runtime/oncetriggers.js +1 -1
- package/dist/Runtime/oncetriggers.js.map +2 -2
- package/dist/Runtime/runtimebehavior.js +1 -1
- package/dist/Runtime/runtimebehavior.js.map +2 -2
- package/dist/Runtime/runtimegame.js +1 -1
- package/dist/Runtime/runtimegame.js.map +2 -2
- package/dist/Runtime/runtimeobject.js +1 -1
- package/dist/Runtime/runtimeobject.js.map +2 -2
- package/dist/Runtime/runtimescene.js +1 -1
- package/dist/Runtime/runtimescene.js.map +2 -2
- package/dist/Runtime/scenestack.js +1 -1
- package/dist/Runtime/scenestack.js.map +2 -2
- package/dist/Runtime/spriteruntimeobject.js +1 -1
- package/dist/Runtime/spriteruntimeobject.js.map +2 -2
- package/dist/Runtime/timemanager.js +1 -1
- package/dist/Runtime/timemanager.js.map +2 -2
- package/dist/Runtime/timer.js +1 -1
- package/dist/Runtime/timer.js.map +2 -2
- package/dist/Runtime/types/global-types.d.ts +29 -0
- package/dist/Runtime/types/project-data.d.ts +144 -3
- package/dist/Runtime/types/save-state.d.ts +9 -0
- package/dist/Runtime/variable.js +1 -1
- package/dist/Runtime/variable.js.map +2 -2
- package/dist/Runtime/variablescontainer.js +1 -1
- package/dist/Runtime/variablescontainer.js.map +2 -2
- package/dist/lib/libGD.cjs +1 -1
- package/dist/lib/libGD.wasm +0 -0
- package/dist/loaders.cjs +1 -1
- package/gd.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/TiledSpriteObject/tiledspriteruntimeobject.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * GDevelop JS Platform\n * 2013 Florian Rival (Florian.Rival@gmail.com)\n */\nnamespace gdjs {\n /** Initial properties for a Tiled Sprite object */\n export type TiledSpriteObjectDataType = {\n /** Default width of the object, if the instance has no custom width. */\n width: number;\n /** Default height of the object, if the instance has no custom height. */\n height: number;\n texture: string;\n };\n\n export type TiledSpriteObjectData = ObjectData & TiledSpriteObjectDataType;\n\n export type TiledSpriteNetworkSyncDataType = {\n xo: number;\n yo: number;\n op: number;\n color: string;\n };\n\n export type TiledSpriteNetworkSyncData = ObjectNetworkSyncData &\n TiledSpriteNetworkSyncDataType;\n\n /**\n * The TiledSpriteRuntimeObject displays a tiled texture.\n */\n export class TiledSpriteRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.OpacityHandler\n {\n _xOffset: float = 0;\n _yOffset: float = 0;\n opacity: float = 255;\n\n // Width and height can be stored because they do not depend on the\n // size of the texture being used (contrary to most objects).\n _width: float;\n _height: float;\n\n _renderer: gdjs.TiledSpriteRuntimeObjectRenderer;\n\n /**\n * @param instanceContainer The container the object belongs to.\n * @param tiledSpriteObjectData The initial properties of the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n tiledSpriteObjectData: TiledSpriteObjectData\n ) {\n super(instanceContainer, tiledSpriteObjectData);\n this._renderer = new gdjs.TiledSpriteRuntimeObjectRenderer(\n this,\n instanceContainer,\n tiledSpriteObjectData.texture\n );\n this._width = 0;\n this._height = 0;\n this.setWidth(tiledSpriteObjectData.width);\n this.setHeight(tiledSpriteObjectData.height);\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n updateFromObjectData(oldObjectData, newObjectData): boolean {\n if (oldObjectData.texture !== newObjectData.texture) {\n this.setTexture(newObjectData.texture, this.getRuntimeScene());\n }\n if (oldObjectData.width !== newObjectData.width) {\n this.setWidth(newObjectData.width);\n }\n if (oldObjectData.height !== newObjectData.height) {\n this.setHeight(newObjectData.height);\n }\n return true;\n }\n\n getNetworkSyncData(): TiledSpriteNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n xo: this.getXOffset(),\n yo: this.getYOffset(),\n op: this.getOpacity(),\n color: this.getColor(),\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: TiledSpriteNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n // Texture is not synchronized, see if this is asked or not.\n\n if (networkSyncData.xo !== undefined) {\n this.setXOffset(networkSyncData.xo);\n }\n if (networkSyncData.yo !== undefined) {\n this.setYOffset(networkSyncData.yo);\n }\n if (networkSyncData.op !== undefined) {\n this.setOpacity(networkSyncData.op);\n }\n if (networkSyncData.color !== undefined) {\n this.setColor(networkSyncData.color);\n }\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n */\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n if (initialInstanceData.opacity !== undefined) {\n this.setOpacity(initialInstanceData.opacity);\n }\n }\n\n /**\n * Set the X position of the Tiled Sprite object.\n * @param x The new X position.\n */\n setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n /**\n * Set the Y position of the Tiled Sprite object.\n * @param y The new Y position.\n */\n setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n /**\n * Assign a new texture to the Tiled Sprite object.\n * @param textureName The name of the image texture resource.\n * @param instanceContainer The container in which the texture is used.\n */\n setTexture(\n textureName: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n this._renderer.setTexture(textureName, instanceContainer);\n }\n\n /**\n * Set the angle of the Tiled Sprite object.\n * @param angle The new angle.\n */\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n /**\n * Get the width of the Tiled Sprite object.\n * @returns The width of the Tiled Sprite object\n */\n getWidth(): float {\n return this._width;\n }\n\n /**\n * Get the height of the Tiled Sprite object.\n * @returns The height of the Tiled Sprite object\n */\n getHeight(): float {\n return this._height;\n }\n\n /**\n * Set the width of the Tiled Sprite object.\n * @param width The new width.\n */\n setWidth(width: float): void {\n if (this._width === width) return;\n\n this._width = width;\n this._renderer.setWidth(width);\n this.invalidateHitboxes();\n }\n\n /**\n * Set the height of the Tiled Sprite object.\n * @param height The new height.\n */\n setHeight(height: float): void {\n if (this._height === height) return;\n\n this._height = height;\n this._renderer.setHeight(height);\n this.invalidateHitboxes();\n }\n\n /**\n * Set the size of the Tiled Sprite object.\n * @param width The new width.\n * @param height The new height.\n */\n setSize(width: float, height: float): void {\n this.setWidth(width);\n this.setHeight(height);\n }\n\n /**\n * Set the offset on the X-axis when displaying the image of the Tiled Sprite object.\n * @param xOffset The new offset on the X-axis.\n */\n setXOffset(xOffset: number): void {\n this._xOffset = xOffset;\n this._renderer.updateXOffset();\n }\n\n /**\n * Set the offset on the Y-axis when displaying the image of the Tiled Sprite object.\n * @param yOffset The new offset on the Y-axis.\n */\n setYOffset(yOffset: number): void {\n this._yOffset = yOffset;\n this._renderer.updateYOffset();\n }\n\n /**\n * Get the offset on the X-axis of the Tiled Sprite object.\n * @returns The offset on the X-axis\n */\n getXOffset(): number {\n return this._xOffset;\n }\n\n /**\n * Get the offset on the Y-axis of the Tiled Sprite object.\n * @returns The offset on the Y-axis\n */\n getYOffset(): number {\n return this._yOffset;\n }\n\n setOpacity(opacity: float): void {\n if (opacity < 0) {\n opacity = 0;\n }\n if (opacity > 255) {\n opacity = 255;\n }\n this.opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n getOpacity(): number {\n return this.opacity;\n }\n\n /**\n * Change the tint of the tiled sprite object.\n *\n * @param rgbColor The color, in RGB format (\"128;200;255\").\n */\n setColor(rgbColor: string): void {\n this._renderer.setColor(rgbColor);\n }\n\n /**\n * Get the tint of the tiled sprite object.\n *\n * @returns The color, in RGB format (\"128;200;255\").\n */\n getColor(): string {\n return this._renderer.getColor();\n }\n\n // Implement support for get/set scale:\n\n /**\n * Get the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n */\n getScale(): float {\n const scaleX = Math.abs(this.getScaleX());\n const scaleY = Math.abs(this.getScaleY());\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Get x-scale of the tiled sprite object.\n */\n getScaleX(): float {\n return this._width / this._renderer.getTextureWidth();\n }\n\n /**\n * Get y-scale of the tiled sprite object.\n */\n getScaleY(): float {\n return this._height / this._renderer.getTextureHeight();\n }\n\n /**\n * Set the tiled sprite object scale.\n * @param newScale The new scale for the tiled sprite object.\n */\n setScale(newScale: float): void {\n this.setWidth(this._renderer.getTextureWidth() * newScale);\n this.setHeight(this._renderer.getTextureHeight() * newScale);\n }\n\n /**\n * Set the tiled sprite object x-scale.\n * @param newScale The new x-scale for the tiled sprite object.\n */\n setScaleX(newScale: float): void {\n this.setWidth(this._renderer.getTextureWidth() * newScale);\n }\n\n /**\n * Set the tiled sprite object y-scale.\n * @param newScale The new y-scale for the tiled sprite object.\n */\n setScaleY(newScale: float): void {\n this.setHeight(this._renderer.getTextureHeight() * newScale);\n }\n }\n gdjs.registerObject(\n 'TiledSpriteObject::TiledSprite',\n gdjs.TiledSpriteRuntimeObject\n );\n}\n"],
|
|
5
|
-
"mappings": "AAIA,GAAU,MAAV,UAAU,EAAV,CAyBS,eACG,GAAK,aAEf,CAgBE,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAnB3B,cAAkB,EAClB,cAAkB,EAClB,aAAiB,IAkBf,KAAK,UAAY,GAAI,GAAK,iCACxB,KACA,EACA,EAAsB,SAExB,KAAK,OAAS,EACd,KAAK,QAAU,EACf,KAAK,SAAS,EAAsB,OACpC,KAAK,UAAU,EAAsB,QAGrC,KAAK,YAGP,qBAAqB,EAAe,EAAwB,CAC1D,MAAI,GAAc,UAAY,EAAc,SAC1C,KAAK,WAAW,EAAc,QAAS,KAAK,mBAE1C,EAAc,QAAU,EAAc,OACxC,KAAK,SAAS,EAAc,OAE1B,EAAc,SAAW,EAAc,QACzC,KAAK,UAAU,EAAc,QAExB,GAGT,
|
|
4
|
+
"sourcesContent": ["/*\n * GDevelop JS Platform\n * 2013 Florian Rival (Florian.Rival@gmail.com)\n */\nnamespace gdjs {\n /** Initial properties for a Tiled Sprite object */\n export type TiledSpriteObjectDataType = {\n /** Default width of the object, if the instance has no custom width. */\n width: number;\n /** Default height of the object, if the instance has no custom height. */\n height: number;\n texture: string;\n };\n\n export type TiledSpriteObjectData = ObjectData & TiledSpriteObjectDataType;\n\n export type TiledSpriteNetworkSyncDataType = {\n xo: number;\n yo: number;\n op: number;\n color: string;\n };\n\n export type TiledSpriteNetworkSyncData = ObjectNetworkSyncData &\n TiledSpriteNetworkSyncDataType;\n\n /**\n * The TiledSpriteRuntimeObject displays a tiled texture.\n */\n export class TiledSpriteRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.OpacityHandler\n {\n _xOffset: float = 0;\n _yOffset: float = 0;\n opacity: float = 255;\n\n // Width and height can be stored because they do not depend on the\n // size of the texture being used (contrary to most objects).\n _width: float;\n _height: float;\n\n _renderer: gdjs.TiledSpriteRuntimeObjectRenderer;\n\n /**\n * @param instanceContainer The container the object belongs to.\n * @param tiledSpriteObjectData The initial properties of the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n tiledSpriteObjectData: TiledSpriteObjectData\n ) {\n super(instanceContainer, tiledSpriteObjectData);\n this._renderer = new gdjs.TiledSpriteRuntimeObjectRenderer(\n this,\n instanceContainer,\n tiledSpriteObjectData.texture\n );\n this._width = 0;\n this._height = 0;\n this.setWidth(tiledSpriteObjectData.width);\n this.setHeight(tiledSpriteObjectData.height);\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n updateFromObjectData(oldObjectData, newObjectData): boolean {\n if (oldObjectData.texture !== newObjectData.texture) {\n this.setTexture(newObjectData.texture, this.getRuntimeScene());\n }\n if (oldObjectData.width !== newObjectData.width) {\n this.setWidth(newObjectData.width);\n }\n if (oldObjectData.height !== newObjectData.height) {\n this.setHeight(newObjectData.height);\n }\n return true;\n }\n\n getNetworkSyncData(\n syncOptons: GetNetworkSyncDataOptions\n ): TiledSpriteNetworkSyncData {\n return {\n ...super.getNetworkSyncData(syncOptons),\n xo: this.getXOffset(),\n yo: this.getYOffset(),\n op: this.getOpacity(),\n color: this.getColor(),\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: TiledSpriteNetworkSyncData,\n options: UpdateFromNetworkSyncDataOptions\n ): void {\n super.updateFromNetworkSyncData(networkSyncData, options);\n\n // Texture is not synchronized, see if this is asked or not.\n\n if (networkSyncData.xo !== undefined) {\n this.setXOffset(networkSyncData.xo);\n }\n if (networkSyncData.yo !== undefined) {\n this.setYOffset(networkSyncData.yo);\n }\n if (networkSyncData.op !== undefined) {\n this.setOpacity(networkSyncData.op);\n }\n if (networkSyncData.color !== undefined) {\n this.setColor(networkSyncData.color);\n }\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n */\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n if (initialInstanceData.opacity !== undefined) {\n this.setOpacity(initialInstanceData.opacity);\n }\n }\n\n /**\n * Set the X position of the Tiled Sprite object.\n * @param x The new X position.\n */\n setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n /**\n * Set the Y position of the Tiled Sprite object.\n * @param y The new Y position.\n */\n setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n /**\n * Assign a new texture to the Tiled Sprite object.\n * @param textureName The name of the image texture resource.\n * @param instanceContainer The container in which the texture is used.\n */\n setTexture(\n textureName: string,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ): void {\n this._renderer.setTexture(textureName, instanceContainer);\n }\n\n /**\n * Set the angle of the Tiled Sprite object.\n * @param angle The new angle.\n */\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n /**\n * Get the width of the Tiled Sprite object.\n * @returns The width of the Tiled Sprite object\n */\n getWidth(): float {\n return this._width;\n }\n\n /**\n * Get the height of the Tiled Sprite object.\n * @returns The height of the Tiled Sprite object\n */\n getHeight(): float {\n return this._height;\n }\n\n /**\n * Set the width of the Tiled Sprite object.\n * @param width The new width.\n */\n setWidth(width: float): void {\n if (this._width === width) return;\n\n this._width = width;\n this._renderer.setWidth(width);\n this.invalidateHitboxes();\n }\n\n /**\n * Set the height of the Tiled Sprite object.\n * @param height The new height.\n */\n setHeight(height: float): void {\n if (this._height === height) return;\n\n this._height = height;\n this._renderer.setHeight(height);\n this.invalidateHitboxes();\n }\n\n /**\n * Set the size of the Tiled Sprite object.\n * @param width The new width.\n * @param height The new height.\n */\n setSize(width: float, height: float): void {\n this.setWidth(width);\n this.setHeight(height);\n }\n\n /**\n * Set the offset on the X-axis when displaying the image of the Tiled Sprite object.\n * @param xOffset The new offset on the X-axis.\n */\n setXOffset(xOffset: number): void {\n this._xOffset = xOffset;\n this._renderer.updateXOffset();\n }\n\n /**\n * Set the offset on the Y-axis when displaying the image of the Tiled Sprite object.\n * @param yOffset The new offset on the Y-axis.\n */\n setYOffset(yOffset: number): void {\n this._yOffset = yOffset;\n this._renderer.updateYOffset();\n }\n\n /**\n * Get the offset on the X-axis of the Tiled Sprite object.\n * @returns The offset on the X-axis\n */\n getXOffset(): number {\n return this._xOffset;\n }\n\n /**\n * Get the offset on the Y-axis of the Tiled Sprite object.\n * @returns The offset on the Y-axis\n */\n getYOffset(): number {\n return this._yOffset;\n }\n\n setOpacity(opacity: float): void {\n if (opacity < 0) {\n opacity = 0;\n }\n if (opacity > 255) {\n opacity = 255;\n }\n this.opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n getOpacity(): number {\n return this.opacity;\n }\n\n /**\n * Change the tint of the tiled sprite object.\n *\n * @param rgbColor The color, in RGB format (\"128;200;255\").\n */\n setColor(rgbColor: string): void {\n this._renderer.setColor(rgbColor);\n }\n\n /**\n * Get the tint of the tiled sprite object.\n *\n * @returns The color, in RGB format (\"128;200;255\").\n */\n getColor(): string {\n return this._renderer.getColor();\n }\n\n // Implement support for get/set scale:\n\n /**\n * Get the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n */\n getScale(): float {\n const scaleX = Math.abs(this.getScaleX());\n const scaleY = Math.abs(this.getScaleY());\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Get x-scale of the tiled sprite object.\n */\n getScaleX(): float {\n return this._width / this._renderer.getTextureWidth();\n }\n\n /**\n * Get y-scale of the tiled sprite object.\n */\n getScaleY(): float {\n return this._height / this._renderer.getTextureHeight();\n }\n\n /**\n * Set the tiled sprite object scale.\n * @param newScale The new scale for the tiled sprite object.\n */\n setScale(newScale: float): void {\n this.setWidth(this._renderer.getTextureWidth() * newScale);\n this.setHeight(this._renderer.getTextureHeight() * newScale);\n }\n\n /**\n * Set the tiled sprite object x-scale.\n * @param newScale The new x-scale for the tiled sprite object.\n */\n setScaleX(newScale: float): void {\n this.setWidth(this._renderer.getTextureWidth() * newScale);\n }\n\n /**\n * Set the tiled sprite object y-scale.\n * @param newScale The new y-scale for the tiled sprite object.\n */\n setScaleY(newScale: float): void {\n this.setHeight(this._renderer.getTextureHeight() * newScale);\n }\n }\n gdjs.registerObject(\n 'TiledSpriteObject::TiledSprite',\n gdjs.TiledSpriteRuntimeObject\n );\n}\n"],
|
|
5
|
+
"mappings": "AAIA,GAAU,MAAV,UAAU,EAAV,CAyBS,eACG,GAAK,aAEf,CAgBE,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAnB3B,cAAkB,EAClB,cAAkB,EAClB,aAAiB,IAkBf,KAAK,UAAY,GAAI,GAAK,iCACxB,KACA,EACA,EAAsB,SAExB,KAAK,OAAS,EACd,KAAK,QAAU,EACf,KAAK,SAAS,EAAsB,OACpC,KAAK,UAAU,EAAsB,QAGrC,KAAK,YAGP,qBAAqB,EAAe,EAAwB,CAC1D,MAAI,GAAc,UAAY,EAAc,SAC1C,KAAK,WAAW,EAAc,Q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UAAU,GAOjB,WAAW,EAAuB,CAChC,KAAK,SAAW,EAChB,KAAK,UAAU,gBAOjB,WAAW,EAAuB,CAChC,KAAK,SAAW,EAChB,KAAK,UAAU,gBAOjB,YAAqB,CACnB,MAAO,MAAK,SAOd,YAAqB,CACnB,MAAO,MAAK,SAGd,WAAW,EAAsB,CAC/B,AAAI,EAAU,GACZ,GAAU,GAER,EAAU,KACZ,GAAU,KAEZ,KAAK,QAAU,EACf,KAAK,UAAU,gBAGjB,YAAqB,CACnB,MAAO,MAAK,QAQd,SAAS,EAAwB,CAC/B,KAAK,UAAU,SAAS,GAQ1B,UAAmB,CACjB,MAAO,MAAK,UAAU,WAUxB,UAAkB,CAChB,KAAM,GAAS,KAAK,IAAI,KAAK,aACvB,EAAS,KAAK,IAAI,KAAK,aAC7B,MAAO,KAAW,EAAS,EAAS,KAAK,KAAK,EAAS,GAMzD,WAAmB,CACjB,MAAO,MAAK,OAAS,KAAK,UAAU,kBAMtC,WAAmB,CACjB,MAAO,MAAK,QAAU,KAAK,UAAU,mBAOvC,SAAS,EAAuB,CAC9B,KAAK,SAAS,KAAK,UAAU,kBAAoB,GACjD,KAAK,UAAU,KAAK,UAAU,mBAAqB,GAOrD,UAAU,EAAuB,CAC/B,KAAK,SAAS,KAAK,UAAU,kBAAoB,GAOnD,UAAU,EAAuB,CAC/B,KAAK,UAAU,KAAK,UAAU,mBAAqB,IAxThD,EAAM,2BA2Tb,EAAK,eACH,iCACA,EAAK,4BAtVC",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(l){class u extends l.RuntimeBehavior{constructor(e,t,f){super(e,t,f);this._angle=0;this._xVelocity=0;this._yVelocity=0;this._angularSpeed=0;this._leftKey=!1;this._rightKey=!1;this._upKey=!1;this._downKey=!1;this._leftKeyPressedDuration=0;this._rightKeyPressedDuration=0;this._upKeyPressedDuration=0;this._downKeyPressedDuration=0;this._wasStickUsed=!1;this._stickAngle=0;this._stickForce=0;this._dontClearInputsBetweenFrames=!1;this._ignoreDefaultControlsAsSyncedByNetwork=!1;this._wasLeftKeyPressed=!1;this._wasRightKeyPressed=!1;this._wasUpKeyPressed=!1;this._wasDownKeyPressed=!1;this._temporaryPointForTransformations=[0,0];this._topDownMovementHooks=[];this._allowDiagonals=t.allowDiagonals,this._acceleration=t.acceleration,this._deceleration=t.deceleration,this._maxSpeed=t.maxSpeed,this._angularMaxSpeed=t.angularMaxSpeed,this._rotateObject=t.rotateObject,this._angleOffset=t.angleOffset,this._ignoreDefaultControls=t.ignoreDefaultControls,this.setViewpoint(t.viewpoint,t.customIsometryAngle),this._movementAngleOffset=t.movementAngleOffset||0,this._useLegacyTurnBack=t.useLegacyTurnBack===void 0?!0:t.useLegacyTurnBack}getNetworkSyncData(){return this._dontClearInputsBetweenFrames=!1,this._ignoreDefaultControlsAsSyncedByNetwork=!1,{...super.getNetworkSyncData(),props:{a:this._angle,xv:this._xVelocity,yv:this._yVelocity,as:this._angularSpeed,lk:this._wasLeftKeyPressed,rk:this._wasRightKeyPressed,uk:this._wasUpKeyPressed,dk:this._wasDownKeyPressed,wsu:this._wasStickUsed,sa:this._stickAngle,sf:this._stickForce}}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e);const t=e.props;t.a!==void 0&&(this._angle=t.a),t.xv!==void 0&&(this._xVelocity=t.xv),t.yv!==void 0&&(this._yVelocity=t.yv),t.as!==void 0&&(this._angularSpeed=t.as),t.lk!==void 0&&(this._leftKey=t.lk),t.rk!==void 0&&(this._rightKey=t.rk),t.uk!==void 0&&(this._upKey=t.uk),t.dk!==void 0&&(this._downKey=t.dk),t.wsu!==void 0&&(this._wasStickUsed=t.wsu),t.sa!==void 0&&(this._stickAngle=t.sa),t.sf!==void 0&&(this._stickForce=t.sf),this._dontClearInputsBetweenFrames=!0,this._ignoreDefaultControlsAsSyncedByNetwork=!0}updateFromBehaviorData(e,t){return e.allowDiagonals!==t.allowDiagonals&&(this._allowDiagonals=t.allowDiagonals),e.acceleration!==t.acceleration&&(this._acceleration=t.acceleration),e.deceleration!==t.deceleration&&(this._deceleration=t.deceleration),e.maxSpeed!==t.maxSpeed&&(this._maxSpeed=t.maxSpeed),e.angularMaxSpeed!==t.angularMaxSpeed&&(this._angularMaxSpeed=t.angularMaxSpeed),e.rotateObject!==t.rotateObject&&(this._rotateObject=t.rotateObject),e.angleOffset!==t.angleOffset&&(this._angleOffset=t.angleOffset),e.ignoreDefaultControls!==t.ignoreDefaultControls&&(this._ignoreDefaultControls=t.ignoreDefaultControls),(e.platformType!==t.platformType||e.customIsometryAngle!==t.customIsometryAngle)&&this.setViewpoint(t.platformType,t.customIsometryAngle),e.movementAngleOffset!==t.movementAngleOffset&&(this._movementAngleOffset=t.movementAngleOffset),!0}setViewpoint(e,t){e==="PixelIsometry"?this._basisTransformation=new l.TopDownMovementRuntimeBehavior.IsometryTransformation(Math.atan(.5)):e==="TrueIsometry"?this._basisTransformation=new l.TopDownMovementRuntimeBehavior.IsometryTransformation(Math.PI/6):e==="CustomIsometry"?this._basisTransformation=new l.TopDownMovementRuntimeBehavior.IsometryTransformation(t*Math.PI/180):this._basisTransformation=null}setAcceleration(e){this._acceleration=e}getAcceleration(){return this._acceleration}setDeceleration(e){this._deceleration=e}getDeceleration(){return this._deceleration}setMaxSpeed(e){this._maxSpeed=e}getMaxSpeed(){return this._maxSpeed}setAngularMaxSpeed(e){this._angularMaxSpeed=e}getAngularMaxSpeed(){return this._angularMaxSpeed}setAngleOffset(e){this._angleOffset=e}getAngleOffset(){return this._angleOffset}allowDiagonals(e){this._allowDiagonals=e}diagonalsAllowed(){return this._allowDiagonals}setRotateObject(e){this._rotateObject=e}isObjectRotated(){return this._rotateObject}isMoving(){return this._xVelocity!==0||this._yVelocity!==0}getSpeed(){return Math.hypot(this._xVelocity,this._yVelocity)}getXVelocity(){return this._xVelocity}setXVelocity(e){this._xVelocity=e}getYVelocity(){return this._yVelocity}setYVelocity(e){this._yVelocity=e}getAngle(){return this._angle}isMovementAngleAround(e,t){return Math.abs(l.evtTools.common.angleDifference(this._angle,e))<=t}setMovementAngleOffset(e){this._movementAngleOffset=e}getMovementAngleOffset(){return this._movementAngleOffset}doStepPreEvents(e){const t=37,f=38,h=39,a=40;this._leftKey||(this._leftKey=!this.shouldIgnoreDefaultControls()&&e.getGame().getInputManager().isKeyPressed(t)),this._rightKey||(this._rightKey=!this.shouldIgnoreDefaultControls()&&e.getGame().getInputManager().isKeyPressed(h)),this._downKey||(this._downKey=!this.shouldIgnoreDefaultControls()&&e.getGame().getInputManager().isKeyPressed(a)),this._upKey||(this._upKey=!this.shouldIgnoreDefaultControls()&&e.getGame().getInputManager().isKeyPressed(f));const n=this.owner.getElapsedTime();this._leftKey?this._leftKeyPressedDuration+=n:this._leftKeyPressedDuration=0,this._rightKey?this._rightKeyPressedDuration+=n:this._rightKeyPressedDuration=0,this._downKey?this._downKeyPressedDuration+=n:this._downKeyPressedDuration=0,this._upKey?this._upKeyPressedDuration+=n:this._upKeyPressedDuration=0;let s=-1;this._allowDiagonals?this._upKey&&!this._downKey?this._leftKey&&!this._rightKey?s=5:!this._leftKey&&this._rightKey?s=7:s=6:!this._upKey&&this._downKey?this._leftKey&&!this._rightKey?s=3:!this._leftKey&&this._rightKey?s=1:s=2:this._leftKey&&!this._rightKey?s=4:!this._leftKey&&this._rightKey&&(s=0):(this._upKey&&!this._downKey?s=6:!this._upKey&&this._downKey&&(s=2),this._leftKey&&!this._rightKey&&(this._upKey===this._downKey||this._upKey&&this._leftKeyPressedDuration<this._upKeyPressedDuration||this._downKey&&this._leftKeyPressedDuration<this._downKeyPressedDuration)?s=4:this._rightKey&&!this._leftKey&&(this._upKey===this._downKey||this._upKey&&this._rightKeyPressedDuration<this._upKeyPressedDuration||this._downKey&&this._rightKeyPressedDuration<this._downKeyPressedDuration)&&(s=0));const o=l.TopDownMovementRuntimeBehavior._topDownMovementHookContext;for(const i of this._topDownMovementHooks)o._setDirection(s),s=i.overrideDirection(o);o._setDirection(s);for(const i of this._topDownMovementHooks)i.beforeSpeedUpdate(o);const r=this.owner,g=this.owner.getElapsedTime()/1e3,x=this._xVelocity,D=this._yVelocity;this._wasStickUsed=!1;let _=0,y=0,d=!1,p=0;if(s!==-1?(d=!0,_=(s+this._movementAngleOffset/45)*Math.PI/4,y=s*45+this._movementAngleOffset,p=this._maxSpeed):this._stickForce!==0?(d=!0,this._allowDiagonals||(this._stickAngle=90*Math.floor((this._stickAngle+45)/90)),y=this._stickAngle+this._movementAngleOffset,_=y*Math.PI/180,p=this._maxSpeed*this._stickForce,this._wasStickUsed=!0):(this._yVelocity!==0||this._xVelocity!==0)&&(d=!0,_=Math.atan2(this._yVelocity,this._xVelocity),y=_*180/Math.PI),d){let i=Math.cos(_),c=Math.sin(_);(i===-1||i===1)&&(c=0),(c===-1||c===1)&&(i=0);let v=Math.hypot(this._xVelocity,this._yVelocity);const M=this._xVelocity*i+this._yVelocity*c;M<0&&(v=M);const k=u.getAcceleratedSpeed(v,p,this._maxSpeed,this._acceleration,this._deceleration,g,this._useLegacyTurnBack);this._xVelocity=k*i,this._yVelocity=k*c}const m=this._xVelocity*this._xVelocity+this._yVelocity*this._yVelocity;if(m>this._maxSpeed*this._maxSpeed){const i=this._maxSpeed/Math.sqrt(m);this._xVelocity*=i,this._yVelocity*=i}this._angularSpeed=this._angularMaxSpeed;for(const i of this._topDownMovementHooks)i.beforePositionUpdate(o);const K=(x+this._xVelocity)/2*g,w=(D+this._yVelocity)/2*g;if(this._basisTransformation===null)r.setX(r.getX()+K),r.setY(r.getY()+w);else{const i=this._temporaryPointForTransformations;i[0]=K,i[1]=w,this._basisTransformation.toScreen(i,i),r.setX(r.getX()+i[0]),r.setY(r.getY()+i[1])}(this._xVelocity!==0||this._yVelocity!==0)&&(this._angle=y,this._rotateObject&&r.rotateTowardAngle(y+this._angleOffset,this._angularSpeed)),this._wasLeftKeyPressed=this._leftKey,this._wasRightKeyPressed=this._rightKey,this._wasUpKeyPressed=this._upKey,this._wasDownKeyPressed=this._downKey,this._dontClearInputsBetweenFrames||(this._leftKey=!1,this._rightKey=!1,this._upKey=!1,this._downKey=!1,this._stickForce=0)}static getAcceleratedSpeed(e,t,f,h,a,n,s=!1){let o=e;const r=s?h:Math.max(h,a);return t<0?e<=t?o=Math.min(t,e+r*n):e<=0?o-=Math.max(-f,h*n):o=Math.max(t,e-r*n):t>0?e>=t?o=Math.max(t,e-r*n):e>=0?o=Math.min(f,e+h*n):o=Math.min(t,e+r*n):(e<0&&(o=Math.min(e+a*n,0)),e>0&&(o=Math.max(e-a*n,0))),o}simulateControl(e){e==="Left"?this._leftKey=!0:e==="Right"?this._rightKey=!0:e==="Up"?this._upKey=!0:e==="Down"&&(this._downKey=!0)}ignoreDefaultControls(e){this._ignoreDefaultControls=e}shouldIgnoreDefaultControls(){return this._ignoreDefaultControls||this._ignoreDefaultControlsAsSyncedByNetwork}simulateLeftKey(){this._leftKey=!0}simulateRightKey(){this._rightKey=!0}simulateUpKey(){this._upKey=!0}simulateDownKey(){this._downKey=!0}simulateStick(e,t){this._stickAngle=e%360,this._stickForce=Math.max(0,Math.min(1,t))}isUsingControl(e){return e==="Left"?this._leftKeyPressedDuration>0:e==="Right"?this._rightKeyPressedDuration>0:e==="Up"?this._upKeyPressedDuration>0:e==="Down"?this._downKeyPressedDuration>0:e==="Stick"?this._wasStickUsed:!1}getLastStickInputAngle(){return this._stickAngle}registerHook(e){this._topDownMovementHooks.push(e)}}l.TopDownMovementRuntimeBehavior=u,function(f){class P{constructor(){this.direction=-1}getDirection(){return this.direction}_setDirection(a){this.direction=a}}f.TopDownMovementHookContext=P,f._topDownMovementHookContext=new l.TopDownMovementRuntimeBehavior.TopDownMovementHookContext;class t{constructor(a){if(a<=0||a>=Math.PI/4)throw new RangeError("An isometry angle must be in ]0; pi/4] but was: "+a);const n=Math.asin(Math.tan(a)),s=Math.sin(n),o=Math.cos(Math.PI/4),r=o;this._screen=[[o,-r],[s*r,s*o]]}toScreen(a,n){const s=this._screen[0][0]*a[0]+this._screen[0][1]*a[1],o=this._screen[1][0]*a[0]+this._screen[1][1]*a[1];n[0]=s,n[1]=o}}f.IsometryTransformation=t}(u=l.TopDownMovementRuntimeBehavior||(l.TopDownMovementRuntimeBehavior={})),l.registerBehavior("TopDownMovementBehavior::TopDownMovementBehavior",l.TopDownMovementRuntimeBehavior)})(gdjs||(gdjs={}));
|
|
1
|
+
var gdjs;(function(f){class u extends f.RuntimeBehavior{constructor(e,t,s){super(e,t,s);this._angle=0;this._xVelocity=0;this._yVelocity=0;this._angularSpeed=0;this._leftKey=!1;this._rightKey=!1;this._upKey=!1;this._downKey=!1;this._leftKeyPressedDuration=0;this._rightKeyPressedDuration=0;this._upKeyPressedDuration=0;this._downKeyPressedDuration=0;this._wasStickUsed=!1;this._stickAngle=0;this._stickForce=0;this._clearInputsBetweenFrames=!0;this._ignoreDefaultControlsAsSyncedByNetwork=!1;this._wasLeftKeyPressed=!1;this._wasRightKeyPressed=!1;this._wasUpKeyPressed=!1;this._wasDownKeyPressed=!1;this._temporaryPointForTransformations=[0,0];this._topDownMovementHooks=[];this._allowDiagonals=t.allowDiagonals,this._acceleration=t.acceleration,this._deceleration=t.deceleration,this._maxSpeed=t.maxSpeed,this._angularMaxSpeed=t.angularMaxSpeed,this._rotateObject=t.rotateObject,this._angleOffset=t.angleOffset,this._ignoreDefaultControls=t.ignoreDefaultControls,this.setViewpoint(t.viewpoint,t.customIsometryAngle),this._movementAngleOffset=t.movementAngleOffset||0,this._useLegacyTurnBack=t.useLegacyTurnBack===void 0?!0:t.useLegacyTurnBack}getNetworkSyncData(e){return this._clearInputsBetweenFrames=!0,this._ignoreDefaultControlsAsSyncedByNetwork=!1,{...super.getNetworkSyncData(e),props:{a:this._angle,xv:this._xVelocity,yv:this._yVelocity,as:this._angularSpeed,lk:this._wasLeftKeyPressed,rk:this._wasRightKeyPressed,uk:this._wasUpKeyPressed,dk:this._wasDownKeyPressed,wsu:this._wasStickUsed,sa:this._stickAngle,sf:this._stickForce}}}updateFromNetworkSyncData(e,t){super.updateFromNetworkSyncData(e,t);const s=e.props;s.a!==void 0&&(this._angle=s.a),s.xv!==void 0&&(this._xVelocity=s.xv),s.yv!==void 0&&(this._yVelocity=s.yv),s.as!==void 0&&(this._angularSpeed=s.as),s.lk!==void 0&&(this._leftKey=s.lk),s.rk!==void 0&&(this._rightKey=s.rk),s.uk!==void 0&&(this._upKey=s.uk),s.dk!==void 0&&(this._downKey=s.dk),s.wsu!==void 0&&(this._wasStickUsed=s.wsu),s.sa!==void 0&&(this._stickAngle=s.sa),s.sf!==void 0&&(this._stickForce=s.sf),this._clearInputsBetweenFrames=!!t.clearInputs,this._ignoreDefaultControlsAsSyncedByNetwork=!t.keepControl}updateFromBehaviorData(e,t){return e.allowDiagonals!==t.allowDiagonals&&(this._allowDiagonals=t.allowDiagonals),e.acceleration!==t.acceleration&&(this._acceleration=t.acceleration),e.deceleration!==t.deceleration&&(this._deceleration=t.deceleration),e.maxSpeed!==t.maxSpeed&&(this._maxSpeed=t.maxSpeed),e.angularMaxSpeed!==t.angularMaxSpeed&&(this._angularMaxSpeed=t.angularMaxSpeed),e.rotateObject!==t.rotateObject&&(this._rotateObject=t.rotateObject),e.angleOffset!==t.angleOffset&&(this._angleOffset=t.angleOffset),e.ignoreDefaultControls!==t.ignoreDefaultControls&&(this._ignoreDefaultControls=t.ignoreDefaultControls),(e.platformType!==t.platformType||e.customIsometryAngle!==t.customIsometryAngle)&&this.setViewpoint(t.platformType,t.customIsometryAngle),e.movementAngleOffset!==t.movementAngleOffset&&(this._movementAngleOffset=t.movementAngleOffset),!0}setViewpoint(e,t){e==="PixelIsometry"?this._basisTransformation=new f.TopDownMovementRuntimeBehavior.IsometryTransformation(Math.atan(.5)):e==="TrueIsometry"?this._basisTransformation=new f.TopDownMovementRuntimeBehavior.IsometryTransformation(Math.PI/6):e==="CustomIsometry"?this._basisTransformation=new f.TopDownMovementRuntimeBehavior.IsometryTransformation(t*Math.PI/180):this._basisTransformation=null}setAcceleration(e){this._acceleration=e}getAcceleration(){return this._acceleration}setDeceleration(e){this._deceleration=e}getDeceleration(){return this._deceleration}setMaxSpeed(e){this._maxSpeed=e}getMaxSpeed(){return this._maxSpeed}setAngularMaxSpeed(e){this._angularMaxSpeed=e}getAngularMaxSpeed(){return this._angularMaxSpeed}setAngleOffset(e){this._angleOffset=e}getAngleOffset(){return this._angleOffset}allowDiagonals(e){this._allowDiagonals=e}diagonalsAllowed(){return this._allowDiagonals}setRotateObject(e){this._rotateObject=e}isObjectRotated(){return this._rotateObject}isMoving(){return this._xVelocity!==0||this._yVelocity!==0}getSpeed(){return Math.hypot(this._xVelocity,this._yVelocity)}getXVelocity(){return this._xVelocity}setXVelocity(e){this._xVelocity=e}getYVelocity(){return this._yVelocity}setYVelocity(e){this._yVelocity=e}getAngle(){return this._angle}isMovementAngleAround(e,t){return Math.abs(f.evtTools.common.angleDifference(this._angle,e))<=t}setMovementAngleOffset(e){this._movementAngleOffset=e}getMovementAngleOffset(){return this._movementAngleOffset}doStepPreEvents(e){const t=37,s=38,h=39,r=40;this._leftKey||(this._leftKey=!this.shouldIgnoreDefaultControls()&&e.getGame().getInputManager().isKeyPressed(t)),this._rightKey||(this._rightKey=!this.shouldIgnoreDefaultControls()&&e.getGame().getInputManager().isKeyPressed(h)),this._downKey||(this._downKey=!this.shouldIgnoreDefaultControls()&&e.getGame().getInputManager().isKeyPressed(r)),this._upKey||(this._upKey=!this.shouldIgnoreDefaultControls()&&e.getGame().getInputManager().isKeyPressed(s));const a=this.owner.getElapsedTime();this._leftKey?this._leftKeyPressedDuration+=a:this._leftKeyPressedDuration=0,this._rightKey?this._rightKeyPressedDuration+=a:this._rightKeyPressedDuration=0,this._downKey?this._downKeyPressedDuration+=a:this._downKeyPressedDuration=0,this._upKey?this._upKeyPressedDuration+=a:this._upKeyPressedDuration=0;let o=-1;this._allowDiagonals?this._upKey&&!this._downKey?this._leftKey&&!this._rightKey?o=5:!this._leftKey&&this._rightKey?o=7:o=6:!this._upKey&&this._downKey?this._leftKey&&!this._rightKey?o=3:!this._leftKey&&this._rightKey?o=1:o=2:this._leftKey&&!this._rightKey?o=4:!this._leftKey&&this._rightKey&&(o=0):(this._upKey&&!this._downKey?o=6:!this._upKey&&this._downKey&&(o=2),this._leftKey&&!this._rightKey&&(this._upKey===this._downKey||this._upKey&&this._leftKeyPressedDuration<this._upKeyPressedDuration||this._downKey&&this._leftKeyPressedDuration<this._downKeyPressedDuration)?o=4:this._rightKey&&!this._leftKey&&(this._upKey===this._downKey||this._upKey&&this._rightKeyPressedDuration<this._upKeyPressedDuration||this._downKey&&this._rightKeyPressedDuration<this._downKeyPressedDuration)&&(o=0));const i=f.TopDownMovementRuntimeBehavior._topDownMovementHookContext;for(const n of this._topDownMovementHooks)i._setDirection(o),o=n.overrideDirection(i);i._setDirection(o);for(const n of this._topDownMovementHooks)n.beforeSpeedUpdate(i);const l=this.owner,g=this.owner.getElapsedTime()/1e3,x=this._xVelocity,D=this._yVelocity;this._wasStickUsed=!1;let _=0,y=0,p=!1,d=0;if(o!==-1?(p=!0,_=(o+this._movementAngleOffset/45)*Math.PI/4,y=o*45+this._movementAngleOffset,d=this._maxSpeed):this._stickForce!==0?(p=!0,this._allowDiagonals||(this._stickAngle=90*Math.floor((this._stickAngle+45)/90)),y=this._stickAngle+this._movementAngleOffset,_=y*Math.PI/180,d=this._maxSpeed*this._stickForce,this._wasStickUsed=!0):(this._yVelocity!==0||this._xVelocity!==0)&&(p=!0,_=Math.atan2(this._yVelocity,this._xVelocity),y=_*180/Math.PI),p){let n=Math.cos(_),c=Math.sin(_);(n===-1||n===1)&&(c=0),(c===-1||c===1)&&(n=0);let v=Math.hypot(this._xVelocity,this._yVelocity);const M=this._xVelocity*n+this._yVelocity*c;M<0&&(v=M);const k=u.getAcceleratedSpeed(v,d,this._maxSpeed,this._acceleration,this._deceleration,g,this._useLegacyTurnBack);this._xVelocity=k*n,this._yVelocity=k*c}const m=this._xVelocity*this._xVelocity+this._yVelocity*this._yVelocity;if(m>this._maxSpeed*this._maxSpeed){const n=this._maxSpeed/Math.sqrt(m);this._xVelocity*=n,this._yVelocity*=n}this._angularSpeed=this._angularMaxSpeed;for(const n of this._topDownMovementHooks)n.beforePositionUpdate(i);const K=(x+this._xVelocity)/2*g,w=(D+this._yVelocity)/2*g;if(this._basisTransformation===null)l.setX(l.getX()+K),l.setY(l.getY()+w);else{const n=this._temporaryPointForTransformations;n[0]=K,n[1]=w,this._basisTransformation.toScreen(n,n),l.setX(l.getX()+n[0]),l.setY(l.getY()+n[1])}(this._xVelocity!==0||this._yVelocity!==0)&&(this._angle=y,this._rotateObject&&l.rotateTowardAngle(y+this._angleOffset,this._angularSpeed)),this._wasLeftKeyPressed=this._leftKey,this._wasRightKeyPressed=this._rightKey,this._wasUpKeyPressed=this._upKey,this._wasDownKeyPressed=this._downKey,this._clearInputsBetweenFrames&&(this._leftKey=!1,this._rightKey=!1,this._upKey=!1,this._downKey=!1,this._stickForce=0)}static getAcceleratedSpeed(e,t,s,h,r,a,o=!1){let i=e;const l=o?h:Math.max(h,r);return t<0?e<=t?i=Math.min(t,e+l*a):e<=0?i-=Math.max(-s,h*a):i=Math.max(t,e-l*a):t>0?e>=t?i=Math.max(t,e-l*a):e>=0?i=Math.min(s,e+h*a):i=Math.min(t,e+l*a):(e<0&&(i=Math.min(e+r*a,0)),e>0&&(i=Math.max(e-r*a,0))),i}simulateControl(e){e==="Left"?this._leftKey=!0:e==="Right"?this._rightKey=!0:e==="Up"?this._upKey=!0:e==="Down"&&(this._downKey=!0)}ignoreDefaultControls(e){this._ignoreDefaultControls=e}shouldIgnoreDefaultControls(){return this._ignoreDefaultControls||this._ignoreDefaultControlsAsSyncedByNetwork}simulateLeftKey(){this._leftKey=!0}simulateRightKey(){this._rightKey=!0}simulateUpKey(){this._upKey=!0}simulateDownKey(){this._downKey=!0}simulateStick(e,t){this._stickAngle=e%360,this._stickForce=Math.max(0,Math.min(1,t))}isUsingControl(e){return e==="Left"?this._leftKeyPressedDuration>0:e==="Right"?this._rightKeyPressedDuration>0:e==="Up"?this._upKeyPressedDuration>0:e==="Down"?this._downKeyPressedDuration>0:e==="Stick"?this._wasStickUsed:!1}getLastStickInputAngle(){return this._stickAngle}registerHook(e){this._topDownMovementHooks.push(e)}}f.TopDownMovementRuntimeBehavior=u,function(s){class P{constructor(){this.direction=-1}getDirection(){return this.direction}_setDirection(r){this.direction=r}}s.TopDownMovementHookContext=P,s._topDownMovementHookContext=new f.TopDownMovementRuntimeBehavior.TopDownMovementHookContext;class t{constructor(r){if(r<=0||r>=Math.PI/4)throw new RangeError("An isometry angle must be in ]0; pi/4] but was: "+r);const a=Math.asin(Math.tan(r)),o=Math.sin(a),i=Math.cos(Math.PI/4),l=i;this._screen=[[i,-l],[o*l,o*i]]}toScreen(r,a){const o=this._screen[0][0]*r[0]+this._screen[0][1]*r[1],i=this._screen[1][0]*r[0]+this._screen[1][1]*r[1];a[0]=o,a[1]=i}}s.IsometryTransformation=t}(u=f.TopDownMovementRuntimeBehavior||(f.TopDownMovementRuntimeBehavior={})),f.registerBehavior("TopDownMovementBehavior::TopDownMovementBehavior",f.TopDownMovementRuntimeBehavior)})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=topdownmovementruntimebehavior.js.map
|
package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nGDevelop - Top-down movement Behavior Extension\nCopyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com)\n */\n\nnamespace gdjs {\n interface TopDownMovementNetworkSyncDataType {\n a: float;\n xv: float;\n yv: float;\n as: float;\n lk: boolean;\n rk: boolean;\n uk: boolean;\n dk: boolean;\n wsu: boolean;\n sa: float;\n sf: float;\n }\n\n export interface TopDownMovementNetworkSyncData\n extends BehaviorNetworkSyncData {\n props: TopDownMovementNetworkSyncDataType;\n }\n /**\n * Allows an object to move in 4 or 8 directions, with customizable speed, accelerations\n * and rotation.\n */\n export class TopDownMovementRuntimeBehavior extends gdjs.RuntimeBehavior {\n //Behavior configuration:\n private _allowDiagonals: boolean;\n private _acceleration: float;\n private _deceleration: float;\n private _maxSpeed: float;\n private _angularMaxSpeed: float;\n private _rotateObject: boolean;\n private _angleOffset: float;\n private _ignoreDefaultControls: boolean;\n private _movementAngleOffset: float;\n private _useLegacyTurnBack: boolean;\n\n /** The latest angle of movement, in degrees. */\n private _angle: float = 0;\n\n //Attributes used when moving\n private _xVelocity: float = 0;\n private _yVelocity: float = 0;\n private _angularSpeed: float = 0;\n\n // Inputs\n private _leftKey: boolean = false;\n private _rightKey: boolean = false;\n private _upKey: boolean = false;\n private _downKey: boolean = false;\n private _leftKeyPressedDuration: float = 0;\n private _rightKeyPressedDuration: float = 0;\n private _upKeyPressedDuration: float = 0;\n private _downKeyPressedDuration: float = 0;\n private _wasStickUsed: boolean = false;\n private _stickAngle: float = 0;\n private _stickForce: float = 0;\n\n // This is useful when the object is synchronized by an external source\n // like in a multiplayer game, and we want to be able to predict the\n // movement of the object, even if the inputs are not updated every frame.\n _dontClearInputsBetweenFrames: boolean = false;\n // This is useful when the object is synchronized over the network,\n // object is controlled by the network and we want to ensure the current player\n // cannot control it.\n _ignoreDefaultControlsAsSyncedByNetwork: boolean = false;\n\n // This is useful for extensions that need to know\n // which keys were pressed and doesn't know the mapping\n // done by the scene events.\n private _wasLeftKeyPressed: boolean = false;\n private _wasRightKeyPressed: boolean = false;\n private _wasUpKeyPressed: boolean = false;\n private _wasDownKeyPressed: boolean = false;\n\n // @ts-ignore The setter \"setViewpoint\" is not detected as an affectation.\n private _basisTransformation: gdjs.TopDownMovementRuntimeBehavior.BasisTransformation | null;\n private _temporaryPointForTransformations: FloatPoint = [0, 0];\n\n private _topDownMovementHooks: Array<gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHook> =\n [];\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n behaviorData,\n owner: gdjs.RuntimeObject\n ) {\n super(instanceContainer, behaviorData, owner);\n this._allowDiagonals = behaviorData.allowDiagonals;\n this._acceleration = behaviorData.acceleration;\n this._deceleration = behaviorData.deceleration;\n this._maxSpeed = behaviorData.maxSpeed;\n this._angularMaxSpeed = behaviorData.angularMaxSpeed;\n this._rotateObject = behaviorData.rotateObject;\n this._angleOffset = behaviorData.angleOffset;\n this._ignoreDefaultControls = behaviorData.ignoreDefaultControls;\n this.setViewpoint(\n behaviorData.viewpoint,\n behaviorData.customIsometryAngle\n );\n this._movementAngleOffset = behaviorData.movementAngleOffset || 0;\n this._useLegacyTurnBack =\n behaviorData.useLegacyTurnBack === undefined\n ? true\n : behaviorData.useLegacyTurnBack;\n }\n\n getNetworkSyncData(): TopDownMovementNetworkSyncData {\n // This method is called, so we are synchronizing this object.\n // Let's clear the inputs between frames as we control it.\n this._dontClearInputsBetweenFrames = false;\n this._ignoreDefaultControlsAsSyncedByNetwork = false;\n\n return {\n ...super.getNetworkSyncData(),\n props: {\n a: this._angle,\n xv: this._xVelocity,\n yv: this._yVelocity,\n as: this._angularSpeed,\n lk: this._wasLeftKeyPressed,\n rk: this._wasRightKeyPressed,\n uk: this._wasUpKeyPressed,\n dk: this._wasDownKeyPressed,\n wsu: this._wasStickUsed,\n sa: this._stickAngle,\n sf: this._stickForce,\n },\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: TopDownMovementNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n const behaviorSpecificProps = networkSyncData.props;\n if (behaviorSpecificProps.a !== undefined) {\n this._angle = behaviorSpecificProps.a;\n }\n if (behaviorSpecificProps.xv !== undefined) {\n this._xVelocity = behaviorSpecificProps.xv;\n }\n if (behaviorSpecificProps.yv !== undefined) {\n this._yVelocity = behaviorSpecificProps.yv;\n }\n if (behaviorSpecificProps.as !== undefined) {\n this._angularSpeed = behaviorSpecificProps.as;\n }\n if (behaviorSpecificProps.lk !== undefined) {\n this._leftKey = behaviorSpecificProps.lk;\n }\n if (behaviorSpecificProps.rk !== undefined) {\n this._rightKey = behaviorSpecificProps.rk;\n }\n if (behaviorSpecificProps.uk !== undefined) {\n this._upKey = behaviorSpecificProps.uk;\n }\n if (behaviorSpecificProps.dk !== undefined) {\n this._downKey = behaviorSpecificProps.dk;\n }\n if (behaviorSpecificProps.wsu !== undefined) {\n this._wasStickUsed = behaviorSpecificProps.wsu;\n }\n if (behaviorSpecificProps.sa !== undefined) {\n this._stickAngle = behaviorSpecificProps.sa;\n }\n if (behaviorSpecificProps.sf !== undefined) {\n this._stickForce = behaviorSpecificProps.sf;\n }\n\n // When the object is synchronized from the network, the inputs must not be cleared.\n this._dontClearInputsBetweenFrames = true;\n // And we are not using the default controls.\n this._ignoreDefaultControlsAsSyncedByNetwork = true;\n }\n\n updateFromBehaviorData(oldBehaviorData, newBehaviorData): boolean {\n if (oldBehaviorData.allowDiagonals !== newBehaviorData.allowDiagonals) {\n this._allowDiagonals = newBehaviorData.allowDiagonals;\n }\n if (oldBehaviorData.acceleration !== newBehaviorData.acceleration) {\n this._acceleration = newBehaviorData.acceleration;\n }\n if (oldBehaviorData.deceleration !== newBehaviorData.deceleration) {\n this._deceleration = newBehaviorData.deceleration;\n }\n if (oldBehaviorData.maxSpeed !== newBehaviorData.maxSpeed) {\n this._maxSpeed = newBehaviorData.maxSpeed;\n }\n if (oldBehaviorData.angularMaxSpeed !== newBehaviorData.angularMaxSpeed) {\n this._angularMaxSpeed = newBehaviorData.angularMaxSpeed;\n }\n if (oldBehaviorData.rotateObject !== newBehaviorData.rotateObject) {\n this._rotateObject = newBehaviorData.rotateObject;\n }\n if (oldBehaviorData.angleOffset !== newBehaviorData.angleOffset) {\n this._angleOffset = newBehaviorData.angleOffset;\n }\n if (\n oldBehaviorData.ignoreDefaultControls !==\n newBehaviorData.ignoreDefaultControls\n ) {\n this._ignoreDefaultControls = newBehaviorData.ignoreDefaultControls;\n }\n if (\n oldBehaviorData.platformType !== newBehaviorData.platformType ||\n oldBehaviorData.customIsometryAngle !==\n newBehaviorData.customIsometryAngle\n ) {\n this.setViewpoint(\n newBehaviorData.platformType,\n newBehaviorData.customIsometryAngle\n );\n }\n if (\n oldBehaviorData.movementAngleOffset !==\n newBehaviorData.movementAngleOffset\n ) {\n this._movementAngleOffset = newBehaviorData.movementAngleOffset;\n }\n return true;\n }\n\n setViewpoint(viewpoint: string, customIsometryAngle: float): void {\n if (viewpoint === 'PixelIsometry') {\n this._basisTransformation =\n new gdjs.TopDownMovementRuntimeBehavior.IsometryTransformation(\n Math.atan(0.5)\n );\n } else if (viewpoint === 'TrueIsometry') {\n this._basisTransformation =\n new gdjs.TopDownMovementRuntimeBehavior.IsometryTransformation(\n Math.PI / 6\n );\n } else if (viewpoint === 'CustomIsometry') {\n this._basisTransformation =\n new gdjs.TopDownMovementRuntimeBehavior.IsometryTransformation(\n (customIsometryAngle * Math.PI) / 180\n );\n } else {\n this._basisTransformation = null;\n }\n }\n\n setAcceleration(acceleration: float): void {\n this._acceleration = acceleration;\n }\n\n getAcceleration() {\n return this._acceleration;\n }\n\n setDeceleration(deceleration: float): void {\n this._deceleration = deceleration;\n }\n\n getDeceleration() {\n return this._deceleration;\n }\n\n setMaxSpeed(maxSpeed: float): void {\n this._maxSpeed = maxSpeed;\n }\n\n getMaxSpeed() {\n return this._maxSpeed;\n }\n\n setAngularMaxSpeed(angularMaxSpeed: float): void {\n this._angularMaxSpeed = angularMaxSpeed;\n }\n\n getAngularMaxSpeed() {\n return this._angularMaxSpeed;\n }\n\n setAngleOffset(angleOffset: float): void {\n this._angleOffset = angleOffset;\n }\n\n getAngleOffset() {\n return this._angleOffset;\n }\n\n allowDiagonals(allow: boolean) {\n this._allowDiagonals = allow;\n }\n\n diagonalsAllowed() {\n return this._allowDiagonals;\n }\n\n setRotateObject(allow: boolean): void {\n this._rotateObject = allow;\n }\n\n isObjectRotated(): boolean {\n return this._rotateObject;\n }\n\n isMoving(): boolean {\n return this._xVelocity !== 0 || this._yVelocity !== 0;\n }\n\n getSpeed(): float {\n return Math.hypot(this._xVelocity, this._yVelocity);\n }\n\n getXVelocity(): float {\n return this._xVelocity;\n }\n\n setXVelocity(velocityX: float): void {\n this._xVelocity = velocityX;\n }\n\n getYVelocity(): float {\n return this._yVelocity;\n }\n\n setYVelocity(velocityY: float): void {\n this._yVelocity = velocityY;\n }\n\n getAngle(): float {\n return this._angle;\n }\n\n isMovementAngleAround(degreeAngle: float, tolerance: float) {\n return (\n Math.abs(\n gdjs.evtTools.common.angleDifference(this._angle, degreeAngle)\n ) <= tolerance\n );\n }\n\n setMovementAngleOffset(movementAngleOffset: float): void {\n this._movementAngleOffset = movementAngleOffset;\n }\n\n getMovementAngleOffset() {\n return this._movementAngleOffset;\n }\n\n doStepPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {\n const LEFTKEY = 37;\n const UPKEY = 38;\n const RIGHTKEY = 39;\n const DOWNKEY = 40;\n\n //Get the player input:\n this._leftKey ||\n (this._leftKey =\n !this.shouldIgnoreDefaultControls() &&\n instanceContainer.getGame().getInputManager().isKeyPressed(LEFTKEY));\n this._rightKey ||\n (this._rightKey =\n !this.shouldIgnoreDefaultControls() &&\n instanceContainer.getGame().getInputManager().isKeyPressed(RIGHTKEY));\n this._downKey ||\n (this._downKey =\n !this.shouldIgnoreDefaultControls() &&\n instanceContainer.getGame().getInputManager().isKeyPressed(DOWNKEY));\n this._upKey ||\n (this._upKey =\n !this.shouldIgnoreDefaultControls() &&\n instanceContainer.getGame().getInputManager().isKeyPressed(UPKEY));\n\n const elapsedTime = this.owner.getElapsedTime();\n\n if (!this._leftKey) {\n this._leftKeyPressedDuration = 0;\n } else {\n this._leftKeyPressedDuration += elapsedTime;\n }\n if (!this._rightKey) {\n this._rightKeyPressedDuration = 0;\n } else {\n this._rightKeyPressedDuration += elapsedTime;\n }\n if (!this._downKey) {\n this._downKeyPressedDuration = 0;\n } else {\n this._downKeyPressedDuration += elapsedTime;\n }\n if (!this._upKey) {\n this._upKeyPressedDuration = 0;\n } else {\n this._upKeyPressedDuration += elapsedTime;\n }\n\n let direction = -1;\n if (!this._allowDiagonals) {\n if (this._upKey && !this._downKey) {\n direction = 6;\n } else if (!this._upKey && this._downKey) {\n direction = 2;\n }\n // when 2 keys are pressed for diagonals the most recently pressed win\n if (\n this._leftKey &&\n !this._rightKey &&\n (this._upKey === this._downKey ||\n (this._upKey &&\n this._leftKeyPressedDuration < this._upKeyPressedDuration) ||\n (this._downKey &&\n this._leftKeyPressedDuration < this._downKeyPressedDuration))\n ) {\n direction = 4;\n } else if (\n this._rightKey &&\n !this._leftKey &&\n (this._upKey === this._downKey ||\n (this._upKey &&\n this._rightKeyPressedDuration < this._upKeyPressedDuration) ||\n (this._downKey &&\n this._rightKeyPressedDuration < this._downKeyPressedDuration))\n ) {\n direction = 0;\n }\n } else {\n if (this._upKey && !this._downKey) {\n if (this._leftKey && !this._rightKey) {\n direction = 5;\n } else if (!this._leftKey && this._rightKey) {\n direction = 7;\n } else {\n direction = 6;\n }\n } else if (!this._upKey && this._downKey) {\n if (this._leftKey && !this._rightKey) {\n direction = 3;\n } else if (!this._leftKey && this._rightKey) {\n direction = 1;\n } else {\n direction = 2;\n }\n } else {\n if (this._leftKey && !this._rightKey) {\n direction = 4;\n } else if (!this._leftKey && this._rightKey) {\n direction = 0;\n }\n }\n }\n\n const hookContext =\n gdjs.TopDownMovementRuntimeBehavior._topDownMovementHookContext;\n for (const topDownMovementHook of this._topDownMovementHooks) {\n hookContext._setDirection(direction);\n direction = topDownMovementHook.overrideDirection(hookContext);\n }\n hookContext._setDirection(direction);\n for (const topDownMovementHook of this._topDownMovementHooks) {\n topDownMovementHook.beforeSpeedUpdate(hookContext);\n }\n\n const object = this.owner;\n const timeDelta = this.owner.getElapsedTime() / 1000;\n const previousVelocityX = this._xVelocity;\n const previousVelocityY = this._yVelocity;\n this._wasStickUsed = false;\n\n // These 4 values are not actually used.\n // JavaScript doesn't allow to declare\n // variables without assigning them a value.\n let directionInRad = 0;\n let directionInDeg = 0;\n\n let isMoving = false;\n let targetedSpeed = 0;\n // Update the speed of the object:\n if (direction !== -1) {\n isMoving = true;\n directionInRad =\n ((direction + this._movementAngleOffset / 45) * Math.PI) / 4.0;\n directionInDeg = direction * 45 + this._movementAngleOffset;\n targetedSpeed = this._maxSpeed;\n } else if (this._stickForce !== 0) {\n isMoving = true;\n if (!this._allowDiagonals) {\n this._stickAngle = 90 * Math.floor((this._stickAngle + 45) / 90);\n }\n directionInDeg = this._stickAngle + this._movementAngleOffset;\n directionInRad = (directionInDeg * Math.PI) / 180;\n targetedSpeed = this._maxSpeed * this._stickForce;\n\n this._wasStickUsed = true;\n } else if (this._yVelocity !== 0 || this._xVelocity !== 0) {\n isMoving = true;\n directionInRad = Math.atan2(this._yVelocity, this._xVelocity);\n directionInDeg = (directionInRad * 180.0) / Math.PI;\n }\n if (isMoving) {\n // This makes the trigo resilient to rounding errors on directionInRad.\n let cos = Math.cos(directionInRad);\n let sin = Math.sin(directionInRad);\n if (cos === -1 || cos === 1) {\n sin = 0;\n }\n if (sin === -1 || sin === 1) {\n cos = 0;\n }\n\n let currentSpeed = Math.hypot(this._xVelocity, this._yVelocity);\n const dotProduct = this._xVelocity * cos + this._yVelocity * sin;\n if (dotProduct < 0) {\n // The object is turning back.\n // Keep the negative velocity projected on the new direction.\n currentSpeed = dotProduct;\n }\n const speed = TopDownMovementRuntimeBehavior.getAcceleratedSpeed(\n currentSpeed,\n targetedSpeed,\n this._maxSpeed,\n this._acceleration,\n this._deceleration,\n timeDelta,\n this._useLegacyTurnBack\n );\n this._xVelocity = speed * cos;\n this._yVelocity = speed * sin;\n }\n\n const squaredSpeed =\n this._xVelocity * this._xVelocity + this._yVelocity * this._yVelocity;\n if (squaredSpeed > this._maxSpeed * this._maxSpeed) {\n const ratio = this._maxSpeed / Math.sqrt(squaredSpeed);\n this._xVelocity *= ratio;\n this._yVelocity *= ratio;\n }\n\n // No acceleration for angular speed for now.\n this._angularSpeed = this._angularMaxSpeed;\n\n for (const topDownMovementHook of this._topDownMovementHooks) {\n topDownMovementHook.beforePositionUpdate(hookContext);\n }\n\n // Position object.\n // This is a Verlet integration considering the acceleration as constant.\n // If you expand deltaX or deltaY, it gives, thanks to the usage of both\n // the old and the new velocity:\n // \"velocity * timeDelta + acceleration * timeDelta^2 / 2\".\n //\n // The acceleration is not actually always constant, particularly with a gamepad,\n // but the error is multiplied by timDelta^3. So, it shouldn't matter much.\n const deltaX = ((previousVelocityX + this._xVelocity) / 2) * timeDelta;\n const deltaY = ((previousVelocityY + this._yVelocity) / 2) * timeDelta;\n if (this._basisTransformation === null) {\n // Top-down viewpoint\n object.setX(object.getX() + deltaX);\n object.setY(object.getY() + deltaY);\n } else {\n // Isometry viewpoint\n const point = this._temporaryPointForTransformations;\n point[0] = deltaX;\n point[1] = deltaY;\n this._basisTransformation.toScreen(point, point);\n object.setX(object.getX() + point[0]);\n object.setY(object.getY() + point[1]);\n }\n\n // Also update angle if needed.\n if (this._xVelocity !== 0 || this._yVelocity !== 0) {\n this._angle = directionInDeg;\n if (this._rotateObject) {\n object.rotateTowardAngle(\n directionInDeg + this._angleOffset,\n this._angularSpeed\n );\n }\n }\n\n this._wasLeftKeyPressed = this._leftKey;\n this._wasRightKeyPressed = this._rightKey;\n this._wasUpKeyPressed = this._upKey;\n this._wasDownKeyPressed = this._downKey;\n if (!this._dontClearInputsBetweenFrames) {\n this._leftKey = false;\n this._rightKey = false;\n this._upKey = false;\n this._downKey = false;\n this._stickForce = 0;\n }\n }\n\n private static getAcceleratedSpeed(\n currentSpeed: float,\n targetedSpeed: float,\n speedMax: float,\n acceleration: float,\n deceleration: float,\n timeDelta: float,\n useLegacyTurnBack: boolean = false\n ): float {\n let newSpeed = currentSpeed;\n const turningBackAcceleration = useLegacyTurnBack\n ? acceleration\n : Math.max(acceleration, deceleration);\n if (targetedSpeed < 0) {\n if (currentSpeed <= targetedSpeed) {\n // Reduce the speed to match the stick force.\n newSpeed = Math.min(\n targetedSpeed,\n currentSpeed + turningBackAcceleration * timeDelta\n );\n } else if (currentSpeed <= 0) {\n // Accelerate\n newSpeed -= Math.max(-speedMax, acceleration * timeDelta);\n } else {\n // Turn back at least as fast as it would stop.\n newSpeed = Math.max(\n targetedSpeed,\n currentSpeed - turningBackAcceleration * timeDelta\n );\n }\n } else if (targetedSpeed > 0) {\n if (currentSpeed >= targetedSpeed) {\n // Reduce the speed to match the stick force.\n newSpeed = Math.max(\n targetedSpeed,\n currentSpeed - turningBackAcceleration * timeDelta\n );\n } else if (currentSpeed >= 0) {\n // Accelerate\n newSpeed = Math.min(\n speedMax,\n currentSpeed + acceleration * timeDelta\n );\n } else {\n // Turn back at least as fast as it would stop.\n newSpeed = Math.min(\n targetedSpeed,\n currentSpeed + turningBackAcceleration * timeDelta\n );\n }\n } else {\n // Decelerate and stop.\n if (currentSpeed < 0) {\n newSpeed = Math.min(currentSpeed + deceleration * timeDelta, 0);\n }\n if (currentSpeed > 0) {\n newSpeed = Math.max(currentSpeed - deceleration * timeDelta, 0);\n }\n }\n return newSpeed;\n }\n\n simulateControl(input: string) {\n if (input === 'Left') {\n this._leftKey = true;\n } else if (input === 'Right') {\n this._rightKey = true;\n } else if (input === 'Up') {\n this._upKey = true;\n } else if (input === 'Down') {\n this._downKey = true;\n }\n }\n\n ignoreDefaultControls(ignore: boolean) {\n this._ignoreDefaultControls = ignore;\n }\n\n shouldIgnoreDefaultControls() {\n return (\n this._ignoreDefaultControls ||\n this._ignoreDefaultControlsAsSyncedByNetwork\n );\n }\n\n simulateLeftKey() {\n this._leftKey = true;\n }\n\n simulateRightKey() {\n this._rightKey = true;\n }\n\n simulateUpKey() {\n this._upKey = true;\n }\n\n simulateDownKey() {\n this._downKey = true;\n }\n\n simulateStick(stickAngle: float, stickForce: float) {\n this._stickAngle = stickAngle % 360;\n this._stickForce = Math.max(0, Math.min(1, stickForce));\n }\n\n /**.\n * @param input The control to be tested [Left,Right,Up,Down,Stick].\n * @returns true if the key was used since the last `doStepPreEvents` call.\n */\n isUsingControl(input: string): boolean {\n if (input === 'Left') {\n return this._leftKeyPressedDuration > 0;\n }\n if (input === 'Right') {\n return this._rightKeyPressedDuration > 0;\n }\n if (input === 'Up') {\n return this._upKeyPressedDuration > 0;\n }\n if (input === 'Down') {\n return this._downKeyPressedDuration > 0;\n }\n if (input === 'Stick') {\n return this._wasStickUsed;\n }\n return false;\n }\n\n getLastStickInputAngle() {\n return this._stickAngle;\n }\n\n /**\n * A hook must typically be registered by a behavior that requires this one\n * in its onCreate function.\n * The hook must stay forever to avoid side effects like a hooks order\n * change. To handle deactivated behavior, the hook can check that its\n * behavior is activated before doing anything.\n */\n registerHook(\n hook: gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHook\n ) {\n this._topDownMovementHooks.push(hook);\n }\n }\n\n export namespace TopDownMovementRuntimeBehavior {\n export class TopDownMovementHookContext {\n private direction: integer = -1;\n\n /**\n * @returns The movement direction from 0 for left to 7 for up-left and\n * -1 for no direction.\n */\n getDirection(): integer {\n return this.direction;\n }\n\n /**\n * This method won't change the direction used by the top-down movement\n * behavior.\n */\n _setDirection(direction: integer): void {\n this.direction = direction;\n }\n }\n\n // This should be a static attribute but it's not possible because of\n // declaration order.\n export const _topDownMovementHookContext =\n new gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHookContext();\n\n /**\n * Allow extensions relying on the top-down movement to customize its\n * behavior a bit.\n */\n export interface TopDownMovementHook {\n /**\n * Return the direction to use instead of the direction given in\n * parameter.\n */\n overrideDirection(hookContext: TopDownMovementHookContext): integer;\n /**\n * Called before the acceleration and new direction is applied to the\n * velocity.\n */\n beforeSpeedUpdate(hookContext: TopDownMovementHookContext): void;\n /**\n * Called before the velocity is applied to the object position and\n * angle.\n */\n beforePositionUpdate(hookContext: TopDownMovementHookContext): void;\n }\n\n export interface BasisTransformation {\n toScreen(worldPoint: FloatPoint, screenPoint: FloatPoint): void;\n }\n\n export class IsometryTransformation\n implements gdjs.TopDownMovementRuntimeBehavior.BasisTransformation\n {\n private _screen: float[][];\n\n /**\n * @param angle between the x axis and the projected isometric x axis.\n * @throws if the angle is not in ]0; pi/4[. Note that 0 is a front viewpoint and pi/4 a top-down viewpoint.\n */\n constructor(angle: float) {\n if (angle <= 0 || angle >= Math.PI / 4)\n throw new RangeError(\n 'An isometry angle must be in ]0; pi/4] but was: ' + angle\n );\n\n const alpha = Math.asin(Math.tan(angle));\n const sinA = Math.sin(alpha);\n const cosB = Math.cos(Math.PI / 4);\n const sinB = cosB;\n // https://en.wikipedia.org/wiki/Isometric_projection\n //\n // / 1 0 0 \\ / cosB 0 -sinB \\ / 1 0 0 \\\n // | 0 cosA sinA | | 0 1 0 | | 0 0 -1 |\n // \\ 0 -sinA cosA / \\ sinB 0 cosB / \\ 0 1 0 /\n this._screen = [\n [cosB, -sinB],\n [sinA * sinB, sinA * cosB],\n ];\n }\n\n toScreen(worldPoint: FloatPoint, screenPoint: FloatPoint): void {\n const x =\n this._screen[0][0] * worldPoint[0] +\n this._screen[0][1] * worldPoint[1];\n const y =\n this._screen[1][0] * worldPoint[0] +\n this._screen[1][1] * worldPoint[1];\n screenPoint[0] = x;\n screenPoint[1] = y;\n }\n }\n }\n\n gdjs.registerBehavior(\n 'TopDownMovementBehavior::TopDownMovementBehavior',\n gdjs.TopDownMovementRuntimeBehavior\n );\n}\n"],
|
|
5
|
-
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAuBS,eAA6C,GAAK,eAAgB,CA0DvE,YACE,EACA,EACA,EACA,CACA,MAAM,EAAmB,EAAc,GAjDjC,YAAgB,EAGhB,gBAAoB,EACpB,gBAAoB,EACpB,mBAAuB,EAGvB,cAAoB,GACpB,eAAqB,GACrB,YAAkB,GAClB,cAAoB,GACpB,6BAAiC,EACjC,8BAAkC,EAClC,2BAA+B,EAC/B,6BAAiC,EACjC,mBAAyB,GACzB,iBAAqB,EACrB,iBAAqB,
|
|
4
|
+
"sourcesContent": ["/*\nGDevelop - Top-down movement Behavior Extension\nCopyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com)\n */\n\nnamespace gdjs {\n interface TopDownMovementNetworkSyncDataType {\n a: float;\n xv: float;\n yv: float;\n as: float;\n lk: boolean;\n rk: boolean;\n uk: boolean;\n dk: boolean;\n wsu: boolean;\n sa: float;\n sf: float;\n }\n\n export interface TopDownMovementNetworkSyncData\n extends BehaviorNetworkSyncData {\n props: TopDownMovementNetworkSyncDataType;\n }\n /**\n * Allows an object to move in 4 or 8 directions, with customizable speed, accelerations\n * and rotation.\n */\n export class TopDownMovementRuntimeBehavior extends gdjs.RuntimeBehavior {\n //Behavior configuration:\n private _allowDiagonals: boolean;\n private _acceleration: float;\n private _deceleration: float;\n private _maxSpeed: float;\n private _angularMaxSpeed: float;\n private _rotateObject: boolean;\n private _angleOffset: float;\n private _ignoreDefaultControls: boolean;\n private _movementAngleOffset: float;\n private _useLegacyTurnBack: boolean;\n\n /** The latest angle of movement, in degrees. */\n private _angle: float = 0;\n\n //Attributes used when moving\n private _xVelocity: float = 0;\n private _yVelocity: float = 0;\n private _angularSpeed: float = 0;\n\n // Inputs\n private _leftKey: boolean = false;\n private _rightKey: boolean = false;\n private _upKey: boolean = false;\n private _downKey: boolean = false;\n private _leftKeyPressedDuration: float = 0;\n private _rightKeyPressedDuration: float = 0;\n private _upKeyPressedDuration: float = 0;\n private _downKeyPressedDuration: float = 0;\n private _wasStickUsed: boolean = false;\n private _stickAngle: float = 0;\n private _stickForce: float = 0;\n\n // This is useful when the object is synchronized by an external source\n // like in a multiplayer game, and we want to be able to predict the\n // movement of the object, even if the inputs are not updated every frame.\n private _clearInputsBetweenFrames: boolean = true;\n // This is useful when the object is synchronized over the network,\n // object is controlled by the network and we want to ensure the current player\n // cannot control it.\n _ignoreDefaultControlsAsSyncedByNetwork: boolean = false;\n\n // This is useful for extensions that need to know\n // which keys were pressed and doesn't know the mapping\n // done by the scene events.\n private _wasLeftKeyPressed: boolean = false;\n private _wasRightKeyPressed: boolean = false;\n private _wasUpKeyPressed: boolean = false;\n private _wasDownKeyPressed: boolean = false;\n\n // @ts-ignore The setter \"setViewpoint\" is not detected as an affectation.\n private _basisTransformation: gdjs.TopDownMovementRuntimeBehavior.BasisTransformation | null;\n private _temporaryPointForTransformations: FloatPoint = [0, 0];\n\n private _topDownMovementHooks: Array<gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHook> =\n [];\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n behaviorData,\n owner: gdjs.RuntimeObject\n ) {\n super(instanceContainer, behaviorData, owner);\n this._allowDiagonals = behaviorData.allowDiagonals;\n this._acceleration = behaviorData.acceleration;\n this._deceleration = behaviorData.deceleration;\n this._maxSpeed = behaviorData.maxSpeed;\n this._angularMaxSpeed = behaviorData.angularMaxSpeed;\n this._rotateObject = behaviorData.rotateObject;\n this._angleOffset = behaviorData.angleOffset;\n this._ignoreDefaultControls = behaviorData.ignoreDefaultControls;\n this.setViewpoint(\n behaviorData.viewpoint,\n behaviorData.customIsometryAngle\n );\n this._movementAngleOffset = behaviorData.movementAngleOffset || 0;\n this._useLegacyTurnBack =\n behaviorData.useLegacyTurnBack === undefined\n ? true\n : behaviorData.useLegacyTurnBack;\n }\n\n getNetworkSyncData(\n options: GetNetworkSyncDataOptions\n ): TopDownMovementNetworkSyncData {\n // This method is called, so we are synchronizing this object.\n // Let's clear the inputs between frames as we control it.\n this._clearInputsBetweenFrames = true;\n this._ignoreDefaultControlsAsSyncedByNetwork = false;\n\n return {\n ...super.getNetworkSyncData(options),\n props: {\n a: this._angle,\n xv: this._xVelocity,\n yv: this._yVelocity,\n as: this._angularSpeed,\n lk: this._wasLeftKeyPressed,\n rk: this._wasRightKeyPressed,\n uk: this._wasUpKeyPressed,\n dk: this._wasDownKeyPressed,\n wsu: this._wasStickUsed,\n sa: this._stickAngle,\n sf: this._stickForce,\n },\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: TopDownMovementNetworkSyncData,\n options: UpdateFromNetworkSyncDataOptions\n ): void {\n super.updateFromNetworkSyncData(networkSyncData, options);\n\n const behaviorSpecificProps = networkSyncData.props;\n if (behaviorSpecificProps.a !== undefined) {\n this._angle = behaviorSpecificProps.a;\n }\n if (behaviorSpecificProps.xv !== undefined) {\n this._xVelocity = behaviorSpecificProps.xv;\n }\n if (behaviorSpecificProps.yv !== undefined) {\n this._yVelocity = behaviorSpecificProps.yv;\n }\n if (behaviorSpecificProps.as !== undefined) {\n this._angularSpeed = behaviorSpecificProps.as;\n }\n if (behaviorSpecificProps.lk !== undefined) {\n this._leftKey = behaviorSpecificProps.lk;\n }\n if (behaviorSpecificProps.rk !== undefined) {\n this._rightKey = behaviorSpecificProps.rk;\n }\n if (behaviorSpecificProps.uk !== undefined) {\n this._upKey = behaviorSpecificProps.uk;\n }\n if (behaviorSpecificProps.dk !== undefined) {\n this._downKey = behaviorSpecificProps.dk;\n }\n if (behaviorSpecificProps.wsu !== undefined) {\n this._wasStickUsed = behaviorSpecificProps.wsu;\n }\n if (behaviorSpecificProps.sa !== undefined) {\n this._stickAngle = behaviorSpecificProps.sa;\n }\n if (behaviorSpecificProps.sf !== undefined) {\n this._stickForce = behaviorSpecificProps.sf;\n }\n\n // Clear user inputs between frames only if requested.\n this._clearInputsBetweenFrames = !!options.clearInputs;\n // And ignore default controls if not asked otherwise.\n this._ignoreDefaultControlsAsSyncedByNetwork = !options.keepControl;\n }\n\n updateFromBehaviorData(oldBehaviorData, newBehaviorData): boolean {\n if (oldBehaviorData.allowDiagonals !== newBehaviorData.allowDiagonals) {\n this._allowDiagonals = newBehaviorData.allowDiagonals;\n }\n if (oldBehaviorData.acceleration !== newBehaviorData.acceleration) {\n this._acceleration = newBehaviorData.acceleration;\n }\n if (oldBehaviorData.deceleration !== newBehaviorData.deceleration) {\n this._deceleration = newBehaviorData.deceleration;\n }\n if (oldBehaviorData.maxSpeed !== newBehaviorData.maxSpeed) {\n this._maxSpeed = newBehaviorData.maxSpeed;\n }\n if (oldBehaviorData.angularMaxSpeed !== newBehaviorData.angularMaxSpeed) {\n this._angularMaxSpeed = newBehaviorData.angularMaxSpeed;\n }\n if (oldBehaviorData.rotateObject !== newBehaviorData.rotateObject) {\n this._rotateObject = newBehaviorData.rotateObject;\n }\n if (oldBehaviorData.angleOffset !== newBehaviorData.angleOffset) {\n this._angleOffset = newBehaviorData.angleOffset;\n }\n if (\n oldBehaviorData.ignoreDefaultControls !==\n newBehaviorData.ignoreDefaultControls\n ) {\n this._ignoreDefaultControls = newBehaviorData.ignoreDefaultControls;\n }\n if (\n oldBehaviorData.platformType !== newBehaviorData.platformType ||\n oldBehaviorData.customIsometryAngle !==\n newBehaviorData.customIsometryAngle\n ) {\n this.setViewpoint(\n newBehaviorData.platformType,\n newBehaviorData.customIsometryAngle\n );\n }\n if (\n oldBehaviorData.movementAngleOffset !==\n newBehaviorData.movementAngleOffset\n ) {\n this._movementAngleOffset = newBehaviorData.movementAngleOffset;\n }\n return true;\n }\n\n setViewpoint(viewpoint: string, customIsometryAngle: float): void {\n if (viewpoint === 'PixelIsometry') {\n this._basisTransformation =\n new gdjs.TopDownMovementRuntimeBehavior.IsometryTransformation(\n Math.atan(0.5)\n );\n } else if (viewpoint === 'TrueIsometry') {\n this._basisTransformation =\n new gdjs.TopDownMovementRuntimeBehavior.IsometryTransformation(\n Math.PI / 6\n );\n } else if (viewpoint === 'CustomIsometry') {\n this._basisTransformation =\n new gdjs.TopDownMovementRuntimeBehavior.IsometryTransformation(\n (customIsometryAngle * Math.PI) / 180\n );\n } else {\n this._basisTransformation = null;\n }\n }\n\n setAcceleration(acceleration: float): void {\n this._acceleration = acceleration;\n }\n\n getAcceleration() {\n return this._acceleration;\n }\n\n setDeceleration(deceleration: float): void {\n this._deceleration = deceleration;\n }\n\n getDeceleration() {\n return this._deceleration;\n }\n\n setMaxSpeed(maxSpeed: float): void {\n this._maxSpeed = maxSpeed;\n }\n\n getMaxSpeed() {\n return this._maxSpeed;\n }\n\n setAngularMaxSpeed(angularMaxSpeed: float): void {\n this._angularMaxSpeed = angularMaxSpeed;\n }\n\n getAngularMaxSpeed() {\n return this._angularMaxSpeed;\n }\n\n setAngleOffset(angleOffset: float): void {\n this._angleOffset = angleOffset;\n }\n\n getAngleOffset() {\n return this._angleOffset;\n }\n\n allowDiagonals(allow: boolean) {\n this._allowDiagonals = allow;\n }\n\n diagonalsAllowed() {\n return this._allowDiagonals;\n }\n\n setRotateObject(allow: boolean): void {\n this._rotateObject = allow;\n }\n\n isObjectRotated(): boolean {\n return this._rotateObject;\n }\n\n isMoving(): boolean {\n return this._xVelocity !== 0 || this._yVelocity !== 0;\n }\n\n getSpeed(): float {\n return Math.hypot(this._xVelocity, this._yVelocity);\n }\n\n getXVelocity(): float {\n return this._xVelocity;\n }\n\n setXVelocity(velocityX: float): void {\n this._xVelocity = velocityX;\n }\n\n getYVelocity(): float {\n return this._yVelocity;\n }\n\n setYVelocity(velocityY: float): void {\n this._yVelocity = velocityY;\n }\n\n getAngle(): float {\n return this._angle;\n }\n\n isMovementAngleAround(degreeAngle: float, tolerance: float) {\n return (\n Math.abs(\n gdjs.evtTools.common.angleDifference(this._angle, degreeAngle)\n ) <= tolerance\n );\n }\n\n setMovementAngleOffset(movementAngleOffset: float): void {\n this._movementAngleOffset = movementAngleOffset;\n }\n\n getMovementAngleOffset() {\n return this._movementAngleOffset;\n }\n\n doStepPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {\n const LEFTKEY = 37;\n const UPKEY = 38;\n const RIGHTKEY = 39;\n const DOWNKEY = 40;\n\n //Get the player input:\n this._leftKey ||\n (this._leftKey =\n !this.shouldIgnoreDefaultControls() &&\n instanceContainer.getGame().getInputManager().isKeyPressed(LEFTKEY));\n this._rightKey ||\n (this._rightKey =\n !this.shouldIgnoreDefaultControls() &&\n instanceContainer.getGame().getInputManager().isKeyPressed(RIGHTKEY));\n this._downKey ||\n (this._downKey =\n !this.shouldIgnoreDefaultControls() &&\n instanceContainer.getGame().getInputManager().isKeyPressed(DOWNKEY));\n this._upKey ||\n (this._upKey =\n !this.shouldIgnoreDefaultControls() &&\n instanceContainer.getGame().getInputManager().isKeyPressed(UPKEY));\n\n const elapsedTime = this.owner.getElapsedTime();\n\n if (!this._leftKey) {\n this._leftKeyPressedDuration = 0;\n } else {\n this._leftKeyPressedDuration += elapsedTime;\n }\n if (!this._rightKey) {\n this._rightKeyPressedDuration = 0;\n } else {\n this._rightKeyPressedDuration += elapsedTime;\n }\n if (!this._downKey) {\n this._downKeyPressedDuration = 0;\n } else {\n this._downKeyPressedDuration += elapsedTime;\n }\n if (!this._upKey) {\n this._upKeyPressedDuration = 0;\n } else {\n this._upKeyPressedDuration += elapsedTime;\n }\n\n let direction = -1;\n if (!this._allowDiagonals) {\n if (this._upKey && !this._downKey) {\n direction = 6;\n } else if (!this._upKey && this._downKey) {\n direction = 2;\n }\n // when 2 keys are pressed for diagonals the most recently pressed win\n if (\n this._leftKey &&\n !this._rightKey &&\n (this._upKey === this._downKey ||\n (this._upKey &&\n this._leftKeyPressedDuration < this._upKeyPressedDuration) ||\n (this._downKey &&\n this._leftKeyPressedDuration < this._downKeyPressedDuration))\n ) {\n direction = 4;\n } else if (\n this._rightKey &&\n !this._leftKey &&\n (this._upKey === this._downKey ||\n (this._upKey &&\n this._rightKeyPressedDuration < this._upKeyPressedDuration) ||\n (this._downKey &&\n this._rightKeyPressedDuration < this._downKeyPressedDuration))\n ) {\n direction = 0;\n }\n } else {\n if (this._upKey && !this._downKey) {\n if (this._leftKey && !this._rightKey) {\n direction = 5;\n } else if (!this._leftKey && this._rightKey) {\n direction = 7;\n } else {\n direction = 6;\n }\n } else if (!this._upKey && this._downKey) {\n if (this._leftKey && !this._rightKey) {\n direction = 3;\n } else if (!this._leftKey && this._rightKey) {\n direction = 1;\n } else {\n direction = 2;\n }\n } else {\n if (this._leftKey && !this._rightKey) {\n direction = 4;\n } else if (!this._leftKey && this._rightKey) {\n direction = 0;\n }\n }\n }\n\n const hookContext =\n gdjs.TopDownMovementRuntimeBehavior._topDownMovementHookContext;\n for (const topDownMovementHook of this._topDownMovementHooks) {\n hookContext._setDirection(direction);\n direction = topDownMovementHook.overrideDirection(hookContext);\n }\n hookContext._setDirection(direction);\n for (const topDownMovementHook of this._topDownMovementHooks) {\n topDownMovementHook.beforeSpeedUpdate(hookContext);\n }\n\n const object = this.owner;\n const timeDelta = this.owner.getElapsedTime() / 1000;\n const previousVelocityX = this._xVelocity;\n const previousVelocityY = this._yVelocity;\n this._wasStickUsed = false;\n\n // These 4 values are not actually used.\n // JavaScript doesn't allow to declare\n // variables without assigning them a value.\n let directionInRad = 0;\n let directionInDeg = 0;\n\n let isMoving = false;\n let targetedSpeed = 0;\n // Update the speed of the object:\n if (direction !== -1) {\n isMoving = true;\n directionInRad =\n ((direction + this._movementAngleOffset / 45) * Math.PI) / 4.0;\n directionInDeg = direction * 45 + this._movementAngleOffset;\n targetedSpeed = this._maxSpeed;\n } else if (this._stickForce !== 0) {\n isMoving = true;\n if (!this._allowDiagonals) {\n this._stickAngle = 90 * Math.floor((this._stickAngle + 45) / 90);\n }\n directionInDeg = this._stickAngle + this._movementAngleOffset;\n directionInRad = (directionInDeg * Math.PI) / 180;\n targetedSpeed = this._maxSpeed * this._stickForce;\n\n this._wasStickUsed = true;\n } else if (this._yVelocity !== 0 || this._xVelocity !== 0) {\n isMoving = true;\n directionInRad = Math.atan2(this._yVelocity, this._xVelocity);\n directionInDeg = (directionInRad * 180.0) / Math.PI;\n }\n if (isMoving) {\n // This makes the trigo resilient to rounding errors on directionInRad.\n let cos = Math.cos(directionInRad);\n let sin = Math.sin(directionInRad);\n if (cos === -1 || cos === 1) {\n sin = 0;\n }\n if (sin === -1 || sin === 1) {\n cos = 0;\n }\n\n let currentSpeed = Math.hypot(this._xVelocity, this._yVelocity);\n const dotProduct = this._xVelocity * cos + this._yVelocity * sin;\n if (dotProduct < 0) {\n // The object is turning back.\n // Keep the negative velocity projected on the new direction.\n currentSpeed = dotProduct;\n }\n const speed = TopDownMovementRuntimeBehavior.getAcceleratedSpeed(\n currentSpeed,\n targetedSpeed,\n this._maxSpeed,\n this._acceleration,\n this._deceleration,\n timeDelta,\n this._useLegacyTurnBack\n );\n this._xVelocity = speed * cos;\n this._yVelocity = speed * sin;\n }\n\n const squaredSpeed =\n this._xVelocity * this._xVelocity + this._yVelocity * this._yVelocity;\n if (squaredSpeed > this._maxSpeed * this._maxSpeed) {\n const ratio = this._maxSpeed / Math.sqrt(squaredSpeed);\n this._xVelocity *= ratio;\n this._yVelocity *= ratio;\n }\n\n // No acceleration for angular speed for now.\n this._angularSpeed = this._angularMaxSpeed;\n\n for (const topDownMovementHook of this._topDownMovementHooks) {\n topDownMovementHook.beforePositionUpdate(hookContext);\n }\n\n // Position object.\n // This is a Verlet integration considering the acceleration as constant.\n // If you expand deltaX or deltaY, it gives, thanks to the usage of both\n // the old and the new velocity:\n // \"velocity * timeDelta + acceleration * timeDelta^2 / 2\".\n //\n // The acceleration is not actually always constant, particularly with a gamepad,\n // but the error is multiplied by timDelta^3. So, it shouldn't matter much.\n const deltaX = ((previousVelocityX + this._xVelocity) / 2) * timeDelta;\n const deltaY = ((previousVelocityY + this._yVelocity) / 2) * timeDelta;\n if (this._basisTransformation === null) {\n // Top-down viewpoint\n object.setX(object.getX() + deltaX);\n object.setY(object.getY() + deltaY);\n } else {\n // Isometry viewpoint\n const point = this._temporaryPointForTransformations;\n point[0] = deltaX;\n point[1] = deltaY;\n this._basisTransformation.toScreen(point, point);\n object.setX(object.getX() + point[0]);\n object.setY(object.getY() + point[1]);\n }\n\n // Also update angle if needed.\n if (this._xVelocity !== 0 || this._yVelocity !== 0) {\n this._angle = directionInDeg;\n if (this._rotateObject) {\n object.rotateTowardAngle(\n directionInDeg + this._angleOffset,\n this._angularSpeed\n );\n }\n }\n\n this._wasLeftKeyPressed = this._leftKey;\n this._wasRightKeyPressed = this._rightKey;\n this._wasUpKeyPressed = this._upKey;\n this._wasDownKeyPressed = this._downKey;\n if (this._clearInputsBetweenFrames) {\n this._leftKey = false;\n this._rightKey = false;\n this._upKey = false;\n this._downKey = false;\n this._stickForce = 0;\n }\n }\n\n private static getAcceleratedSpeed(\n currentSpeed: float,\n targetedSpeed: float,\n speedMax: float,\n acceleration: float,\n deceleration: float,\n timeDelta: float,\n useLegacyTurnBack: boolean = false\n ): float {\n let newSpeed = currentSpeed;\n const turningBackAcceleration = useLegacyTurnBack\n ? acceleration\n : Math.max(acceleration, deceleration);\n if (targetedSpeed < 0) {\n if (currentSpeed <= targetedSpeed) {\n // Reduce the speed to match the stick force.\n newSpeed = Math.min(\n targetedSpeed,\n currentSpeed + turningBackAcceleration * timeDelta\n );\n } else if (currentSpeed <= 0) {\n // Accelerate\n newSpeed -= Math.max(-speedMax, acceleration * timeDelta);\n } else {\n // Turn back at least as fast as it would stop.\n newSpeed = Math.max(\n targetedSpeed,\n currentSpeed - turningBackAcceleration * timeDelta\n );\n }\n } else if (targetedSpeed > 0) {\n if (currentSpeed >= targetedSpeed) {\n // Reduce the speed to match the stick force.\n newSpeed = Math.max(\n targetedSpeed,\n currentSpeed - turningBackAcceleration * timeDelta\n );\n } else if (currentSpeed >= 0) {\n // Accelerate\n newSpeed = Math.min(\n speedMax,\n currentSpeed + acceleration * timeDelta\n );\n } else {\n // Turn back at least as fast as it would stop.\n newSpeed = Math.min(\n targetedSpeed,\n currentSpeed + turningBackAcceleration * timeDelta\n );\n }\n } else {\n // Decelerate and stop.\n if (currentSpeed < 0) {\n newSpeed = Math.min(currentSpeed + deceleration * timeDelta, 0);\n }\n if (currentSpeed > 0) {\n newSpeed = Math.max(currentSpeed - deceleration * timeDelta, 0);\n }\n }\n return newSpeed;\n }\n\n simulateControl(input: string) {\n if (input === 'Left') {\n this._leftKey = true;\n } else if (input === 'Right') {\n this._rightKey = true;\n } else if (input === 'Up') {\n this._upKey = true;\n } else if (input === 'Down') {\n this._downKey = true;\n }\n }\n\n ignoreDefaultControls(ignore: boolean) {\n this._ignoreDefaultControls = ignore;\n }\n\n shouldIgnoreDefaultControls() {\n return (\n this._ignoreDefaultControls ||\n this._ignoreDefaultControlsAsSyncedByNetwork\n );\n }\n\n simulateLeftKey() {\n this._leftKey = true;\n }\n\n simulateRightKey() {\n this._rightKey = true;\n }\n\n simulateUpKey() {\n this._upKey = true;\n }\n\n simulateDownKey() {\n this._downKey = true;\n }\n\n simulateStick(stickAngle: float, stickForce: float) {\n this._stickAngle = stickAngle % 360;\n this._stickForce = Math.max(0, Math.min(1, stickForce));\n }\n\n /**.\n * @param input The control to be tested [Left,Right,Up,Down,Stick].\n * @returns true if the key was used since the last `doStepPreEvents` call.\n */\n isUsingControl(input: string): boolean {\n if (input === 'Left') {\n return this._leftKeyPressedDuration > 0;\n }\n if (input === 'Right') {\n return this._rightKeyPressedDuration > 0;\n }\n if (input === 'Up') {\n return this._upKeyPressedDuration > 0;\n }\n if (input === 'Down') {\n return this._downKeyPressedDuration > 0;\n }\n if (input === 'Stick') {\n return this._wasStickUsed;\n }\n return false;\n }\n\n getLastStickInputAngle() {\n return this._stickAngle;\n }\n\n /**\n * A hook must typically be registered by a behavior that requires this one\n * in its onCreate function.\n * The hook must stay forever to avoid side effects like a hooks order\n * change. To handle deactivated behavior, the hook can check that its\n * behavior is activated before doing anything.\n */\n registerHook(\n hook: gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHook\n ) {\n this._topDownMovementHooks.push(hook);\n }\n }\n\n export namespace TopDownMovementRuntimeBehavior {\n export class TopDownMovementHookContext {\n private direction: integer = -1;\n\n /**\n * @returns The movement direction from 0 for left to 7 for up-left and\n * -1 for no direction.\n */\n getDirection(): integer {\n return this.direction;\n }\n\n /**\n * This method won't change the direction used by the top-down movement\n * behavior.\n */\n _setDirection(direction: integer): void {\n this.direction = direction;\n }\n }\n\n // This should be a static attribute but it's not possible because of\n // declaration order.\n export const _topDownMovementHookContext =\n new gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHookContext();\n\n /**\n * Allow extensions relying on the top-down movement to customize its\n * behavior a bit.\n */\n export interface TopDownMovementHook {\n /**\n * Return the direction to use instead of the direction given in\n * parameter.\n */\n overrideDirection(hookContext: TopDownMovementHookContext): integer;\n /**\n * Called before the acceleration and new direction is applied to the\n * velocity.\n */\n beforeSpeedUpdate(hookContext: TopDownMovementHookContext): void;\n /**\n * Called before the velocity is applied to the object position and\n * angle.\n */\n beforePositionUpdate(hookContext: TopDownMovementHookContext): void;\n }\n\n export interface BasisTransformation {\n toScreen(worldPoint: FloatPoint, screenPoint: FloatPoint): void;\n }\n\n export class IsometryTransformation\n implements gdjs.TopDownMovementRuntimeBehavior.BasisTransformation\n {\n private _screen: float[][];\n\n /**\n * @param angle between the x axis and the projected isometric x axis.\n * @throws if the angle is not in ]0; pi/4[. Note that 0 is a front viewpoint and pi/4 a top-down viewpoint.\n */\n constructor(angle: float) {\n if (angle <= 0 || angle >= Math.PI / 4)\n throw new RangeError(\n 'An isometry angle must be in ]0; pi/4] but was: ' + angle\n );\n\n const alpha = Math.asin(Math.tan(angle));\n const sinA = Math.sin(alpha);\n const cosB = Math.cos(Math.PI / 4);\n const sinB = cosB;\n // https://en.wikipedia.org/wiki/Isometric_projection\n //\n // / 1 0 0 \\ / cosB 0 -sinB \\ / 1 0 0 \\\n // | 0 cosA sinA | | 0 1 0 | | 0 0 -1 |\n // \\ 0 -sinA cosA / \\ sinB 0 cosB / \\ 0 1 0 /\n this._screen = [\n [cosB, -sinB],\n [sinA * sinB, sinA * cosB],\n ];\n }\n\n toScreen(worldPoint: FloatPoint, screenPoint: FloatPoint): void {\n const x =\n this._screen[0][0] * worldPoint[0] +\n this._screen[0][1] * worldPoint[1];\n const y =\n this._screen[1][0] * worldPoint[0] +\n this._screen[1][1] * worldPoint[1];\n screenPoint[0] = x;\n screenPoint[1] = y;\n }\n }\n }\n\n gdjs.registerBehavior(\n 'TopDownMovementBehavior::TopDownMovementBehavior',\n gdjs.T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ACL,KAAK,cAEP,GAGT,wBAAyB,CACvB,MAAO,MAAK,YAUd,aACE,EACA,CACA,KAAK,sBAAsB,KAAK,IAtsB7B,EAAM,iCA0sBN,SAAU,EAAV,CACE,OAAiC,CAAjC,aAvuBX,CAwuBc,eAAqB,GAM7B,cAAwB,CACtB,MAAO,MAAK,UAOd,cAAc,EAA0B,CACtC,KAAK,UAAY,GAhBd,EAAM,6BAsBA,8BACX,GAAI,GAAK,+BAA+B,2BA4BnC,OAEP,CAOE,YAAY,EAAc,CACxB,GAAI,GAAS,GAAK,GAAS,KAAK,GAAK,EACnC,KAAM,IAAI,YACR,mDAAqD,GAGzD,KAAM,GAAQ,KAAK,KAAK,KAAK,IAAI,IAC3B,EAAO,KAAK,IAAI,GAChB,EAAO,KAAK,IAAI,KAAK,GAAK,GAC1B,EAAO,EAMb,KAAK,QAAU,CACb,CAAC,EAAM,CAAC,GACR,CAAC,EAAO,EAAM,EAAO,IAIzB,SAAS,EAAwB,EAA+B,CAC9D,KAAM,GACJ,KAAK,QAAQ,GAAG,GAAK,EAAW,GAChC,KAAK,QAAQ,GAAG,GAAK,EAAW,GAC5B,EACJ,KAAK,QAAQ,GAAG,GAAK,EAAW,GAChC,KAAK,QAAQ,GAAG,GAAK,EAAW,GAClC,EAAY,GAAK,EACjB,EAAY,GAAK,GAtCd,EAAM,0BApDE,2EA+FjB,EAAK,iBACH,mDACA,EAAK,kCAl0BC",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var gdjs;(function(
|
|
1
|
+
var gdjs;(function(u){let I;(function(w){let p;(function(d){/*!
|
|
2
2
|
* All equations are adapted from Thomas Fuchs'
|
|
3
3
|
* [Scripty2](https://github.com/madrobby/scripty2/blob/master/src/effects/transitions/penner.js).
|
|
4
4
|
*
|
|
@@ -9,5 +9,5 @@ var gdjs;(function(d){let b;(function(f){let v;(function(l){class p{constructor(
|
|
|
9
9
|
* TERMS OF USE - EASING EQUATIONS
|
|
10
10
|
* Open source under the BSD License.
|
|
11
11
|
* Easing Equations (c) 2003 Robert Penner, all rights reserved.
|
|
12
|
-
*//*! Shifty 3.0.3 - https://github.com/jeremyckahn/shifty */
|
|
12
|
+
*//*! Shifty 3.0.3 - https://github.com/jeremyckahn/shifty */d.easingFunctions={linear:e=>e,easeInQuad:e=>Math.pow(e,2),easeOutQuad:e=>-(Math.pow(e-1,2)-1),easeInOutQuad:e=>(e/=.5)<1?.5*Math.pow(e,2):-.5*((e-=2)*e-2),easeInCubic:e=>Math.pow(e,3),easeOutCubic:e=>Math.pow(e-1,3)+1,easeInOutCubic:e=>(e/=.5)<1?.5*Math.pow(e,3):.5*(Math.pow(e-2,3)+2),easeInQuart:e=>Math.pow(e,4),easeOutQuart:e=>-(Math.pow(e-1,4)-1),easeInOutQuart:e=>(e/=.5)<1?.5*Math.pow(e,4):-.5*((e-=2)*Math.pow(e,3)-2),easeInQuint:e=>Math.pow(e,5),easeOutQuint:e=>Math.pow(e-1,5)+1,easeInOutQuint:e=>(e/=.5)<1?.5*Math.pow(e,5):.5*(Math.pow(e-2,5)+2),easeInSine:e=>-Math.cos(e*(Math.PI/2))+1,easeOutSine:e=>Math.sin(e*(Math.PI/2)),easeInOutSine:e=>-.5*(Math.cos(Math.PI*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>e===0?0:e===1?1:(e/=.5)<1?.5*Math.pow(2,10*(e-1)):.5*(-Math.pow(2,-10*--e)+2),easeInCirc:e=>-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,easeInBack:e=>{const t=1.70158;return e*e*((t+1)*e-t)},easeOutBack:e=>{const t=1.70158;return(e=e-1)*e*((t+1)*e+t)+1},easeInOutBack:e=>{let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},elastic:e=>-1*Math.pow(4,-8*e)*Math.sin((e*6-1)*(2*Math.PI)/2)+1,swingFromTo:e=>{let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},swingFrom:e=>{const t=1.70158;return e*e*((t+1)*e-t)},swingTo:e=>{const t=1.70158;return(e-=1)*e*((t+1)*e+t)+1},bounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,bouncePast:e=>e<1/2.75?7.5625*e*e:e<2/2.75?2-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?2-(7.5625*(e-=2.25/2.75)*e+.9375):2-(7.5625*(e-=2.625/2.75)*e+.984375),easeFromTo:e=>(e/=.5)<1?.5*Math.pow(e,4):-.5*((e-=2)*Math.pow(e,3)-2),easeFrom:e=>Math.pow(e,4),easeTo:e=>Math.pow(e,.25)};class V{constructor(){this._tweens=new Map;this._activeTweens=new Array}step(){let t=0;for(let n=0;n<this._activeTweens.length;n++){const i=this._activeTweens[n];i.step(),i.hasFinished()||(this._activeTweens[t]=i,t++)}this._activeTweens.length=t}addSimpleTween(t,n,i,r,o,a,s,h,c,m){const f=d.easingFunctions[r];if(!f)return;this.removeTween(t);const l=new v(n,i,f,r,o,a,s,h,c,m);this._tweens.set(t,l),this._addActiveTween(l)}addMultiTween(t,n,i,r,o,a,s,h,c,m){const f=d.easingFunctions[r];if(!f)return;this.removeTween(t);const l=new M(n,i,f,r,o,a,s,h,c,m);this._tweens.set(t,l),this._addActiveTween(l)}exists(t){return this._tweens.has(t)}isPlaying(t){const n=this._tweens.get(t);return!!n&&n.isPlaying()}hasFinished(t){const n=this._tweens.get(t);return!!n&&n.hasFinished()}pauseTween(t){const n=this._tweens.get(t);!n||!n.isPlaying()||n.hasFinished()||(this._removeActiveTween(n),n.pause())}resumeTween(t){const n=this._tweens.get(t);!n||n.isPlaying()||n.hasFinished()||(this._addActiveTween(n),n.resume())}stopTween(t,n){const i=this._tweens.get(t);!i||i.hasFinished()||(i.isPlaying()&&this._removeActiveTween(i),i.stop(n))}removeTween(t){const n=this._tweens.get(t);!n||(n.isPlaying()&&this._removeActiveTween(n),this._tweens.delete(t))}_addActiveTween(t){this._activeTweens.push(t)}_removeActiveTween(t){const n=this._activeTweens.findIndex(i=>i===t);this._activeTweens.splice(n,1)}getProgress(t){const n=this._tweens.get(t);return n?n.getProgress():0}getValue(t){const n=this._tweens.get(t);return n?n.getValue():0}getNetworkSyncData(){const t={tweens:{}};return this._tweens.forEach((n,i)=>{t.tweens[i]=n.getNetworkSyncData()}),t}updateFromNetworkSyncData(t,n,i,r){Object.entries(t.tweens).forEach(([o,a])=>{const s=n(a.tweenInformation),h=i(a.tweenInformation),c=r(a.tweenInformation),m=a.interpolationString==="exponential"?u.evtTools.common.exponentialInterpolation:u.evtTools.common.lerp,f={type:a.tweenInformation.type,layerName:a.tweenInformation.layerName,effectName:a.tweenInformation.effectName,propertyName:a.tweenInformation.propertyName,scaleFromCenterOfObject:a.tweenInformation.scaleFromCenterOfObject,useHSLColorTransition:a.tweenInformation.useHSLColorTransition,destroyObjectWhenFinished:a.tweenInformation.destroyObjectWhenFinished};if(a.tweenInformation.variablePath&&(s instanceof u.RuntimeScene||s instanceof u.RuntimeObject)){const l=s.getVariables().getVariableFromPath(a.tweenInformation.variablePath);l&&(f.variable=l)}if(typeof a.initialValue=="number"&&typeof a.targetedValue=="number"){this.addSimpleTween(o,s,a.totalDuration,a.easingIdentifier,m,a.initialValue,a.targetedValue,h,f,c);const l=this._tweens.get(o);l&&(l.updateElapsedTime(a.elapsedTime),a.isPaused&&this.pauseTween(o))}else if(Array.isArray(a.initialValue)&&Array.isArray(a.targetedValue)){this.addMultiTween(o,s,a.totalDuration,a.easingIdentifier,m,a.initialValue,a.targetedValue,h,f,c);const l=this._tweens.get(o);l&&(l.updateElapsedTime(a.elapsedTime),a.isPaused&&this.pauseTween(o))}})}}d.TweenManager=V;const b=()=>{};class T{constructor(t,n,i,r,o,a,s){this.isPaused=!1;this.timeSource=t,this.totalDuration=n,this.easing=i,this.easingIdentifier=r,this.interpolate=o,this.tweenInformation=a,this.elapsedTime=0,this.onFinish=s||b}step(){!this.isPlaying()||(this.elapsedTime=Math.min(this.elapsedTime+this.timeSource.getElapsedTime()/1e3,this.totalDuration),this._updateValue())}isPlaying(){return!this.isPaused&&!this.hasFinished()}hasFinished(){return this.elapsedTime===this.totalDuration}stop(t){this.elapsedTime=this.totalDuration,t&&this._updateValue()}resume(){this.isPaused=!1}pause(){this.isPaused=!0}getProgress(){return this.elapsedTime/this.totalDuration}updateElapsedTime(t){this.elapsedTime=t}}d.AbstractTweenInstance=T;class v extends T{constructor(t,n,i,r,o,a,s,h,c,m){super(t,n,i,r,o,c,m);this.initialValue=a,this.currentValue=a,this.targetedValue=s,this.setValue=h}_updateValue(){const t=this.easing(this.getProgress()),n=this.interpolate(this.initialValue,this.targetedValue,t);this.currentValue=n,this.setValue(n),this.hasFinished()&&this.onFinish()}getValue(){return this.currentValue}getNetworkSyncData(){const t=this.interpolate===u.evtTools.common.exponentialInterpolation?"exponential":"linear",n={type:this.tweenInformation.type,layerName:this.tweenInformation.layerName,effectName:this.tweenInformation.effectName,propertyName:this.tweenInformation.propertyName,scaleFromCenterOfObject:this.tweenInformation.scaleFromCenterOfObject,useHSLColorTransition:this.tweenInformation.useHSLColorTransition,destroyObjectWhenFinished:this.tweenInformation.destroyObjectWhenFinished};if(this.tweenInformation.variable&&(this.timeSource instanceof u.RuntimeScene||this.timeSource instanceof u.RuntimeObject)){const i=this.timeSource.getVariables().getVariablePathInContainerByLoopingThroughAllVariables(this.tweenInformation.variable);i&&(n.variablePath=i)}return{initialValue:this.initialValue,targetedValue:this.targetedValue,elapsedTime:this.elapsedTime,totalDuration:this.totalDuration,easingIdentifier:this.easingIdentifier,interpolationString:t,isPaused:this.isPaused,tweenInformation:n}}}d.SimpleTweenInstance=v;class M extends T{constructor(t,n,i,r,o,a,s,h,c,m){super(t,n,i,r,o,c,m);this.currentValues=new Array;this.initialValue=a,this.targetedValue=s,this.setValue=h}_updateValue(){const t=this.easing(this.getProgress()),n=this.initialValue.length;this.currentValues.length=n;for(let i=0;i<n;i++)this.currentValues[i]=this.interpolate(this.initialValue[i],this.targetedValue[i],t);this.setValue(this.currentValues),this.hasFinished()&&this.onFinish()}getValue(){return 0}getNetworkSyncData(){const t=this.interpolate===u.evtTools.common.exponentialInterpolation?"exponential":"linear";return{initialValue:this.initialValue,targetedValue:this.targetedValue,elapsedTime:this.elapsedTime,totalDuration:this.totalDuration,easingIdentifier:this.easingIdentifier,interpolationString:t,isPaused:this.isPaused,tweenInformation:this.tweenInformation}}}d.MultiTweenInstance=M,d.rgbToHsl=(e,t,n)=>{e/=255,t/=255,n/=255;let i=Math.max(e,t,n),r=i-Math.min(e,t,n),o=1-Math.abs(i+i-r-1),a=r&&(i===e?(t-n)/r:i===t?2+(n-e)/r:4+(e-t)/r);return[Math.round(60*(a<0?a+6:a)),Math.round((o?r/o:0)*100),Math.round((i+i-r)/2*100)]},d.hslToRgb=(e,t,n)=>{e=e%=360,e<0&&(e+=360),t=t/100,n=n/100;const i=t*Math.min(n,1-n),r=(o=0,a=(o+e/30)%12)=>n-i*Math.max(Math.min(a-3,9-a,1),-1);return[Math.round(r(0)*255),Math.round(r(8)*255),Math.round(r(4)*255)]},d.ease=(e,t,n,i)=>{const r=u.evtTools.tween.easingFunctions,o=r.hasOwnProperty(e)?r[e]:r.linear;return t+(n-t)*o(i)}})(p=w.tween||(w.tween={}))})(I=u.evtTools||(u.evtTools={}))})(gdjs||(gdjs={}));
|
|
13
13
|
//# sourceMappingURL=TweenManager.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/TweenBehavior/TweenManager.ts"],
|
|
4
|
-
"sourcesContent": ["namespace gdjs {\n export namespace evtTools {\n export namespace tween {\n /**\n * A tween manager that is used for layout tweens or object tweens.\n * @ignore\n */\n export class TweenManager {\n /**\n * All the tweens of a layout or a behavior.\n */\n private _tweens = new Map<string, TweenInstance>();\n /**\n * Allow fast iteration on tween that are active.\n */\n private _activeTweens = new Array<TweenInstance>();\n\n constructor() {}\n\n /**\n * Make all active tween step toward the end.\n * @param timeDelta the duration from the previous step in seconds\n * @param layoutTimeDelta the duration from the previous step ignoring layer time scale in seconds\n */\n step(): void {\n let writeIndex = 0;\n for (\n let readIndex = 0;\n readIndex < this._activeTweens.length;\n readIndex++\n ) {\n const tween = this._activeTweens[readIndex];\n\n tween.step();\n if (!tween.hasFinished()) {\n this._activeTweens[writeIndex] = tween;\n writeIndex++;\n }\n }\n this._activeTweens.length = writeIndex;\n }\n\n /**\n * Add a tween on one value.\n */\n addSimpleTween(\n identifier: string,\n timeSource: TimeSource,\n totalDuration: number,\n easingIdentifier: string,\n interpolate: Interpolation,\n initialValue: float,\n targetedValue: float,\n setValue: (value: float) => void,\n onFinish?: (() => void) | null\n ): void {\n const easing = easingFunctions[easingIdentifier];\n if (!easing) return;\n\n // Remove any prior tween\n this.removeTween(identifier);\n\n // Initialize the tween instance\n const tween = new SimpleTweenInstance(\n timeSource,\n totalDuration,\n easing,\n interpolate,\n initialValue,\n targetedValue,\n setValue,\n onFinish\n );\n this._tweens.set(identifier, tween);\n this._addActiveTween(tween);\n }\n\n /**\n * Add a tween on several values.\n */\n addMultiTween(\n identifier: string,\n timeSource: TimeSource,\n totalDuration: number,\n easingIdentifier: string,\n interpolate: Interpolation,\n initialValue: Array<float>,\n targetedValue: Array<float>,\n setValue: (value: Array<float>) => void,\n onFinish?: (() => void) | null\n ): void {\n const easing = easingFunctions[easingIdentifier];\n if (!easing) return;\n\n // Remove any prior tween\n this.removeTween(identifier);\n\n // Initialize the tween instance\n const tween = new MultiTweenInstance(\n timeSource,\n totalDuration,\n easing,\n interpolate,\n initialValue,\n targetedValue,\n setValue,\n onFinish\n );\n this._tweens.set(identifier, tween);\n this._addActiveTween(tween);\n }\n\n /**\n * Tween exists.\n * @param identifier Unique id to identify the tween\n * @returns The tween exists\n */\n exists(identifier: string): boolean {\n return this._tweens.has(identifier);\n }\n\n /**\n * Tween is playing.\n * @param identifier Unique id to identify the tween\n */\n isPlaying(identifier: string): boolean {\n const tween = this._tweens.get(identifier);\n return !!tween && tween.isPlaying();\n }\n\n /**\n * Tween has finished.\n * @param identifier Unique id to identify the tween\n */\n hasFinished(identifier: string): boolean {\n const tween = this._tweens.get(identifier);\n return !!tween && tween.hasFinished();\n }\n\n /**\n * Pause a tween.\n * @param identifier Unique id to identify the tween\n */\n pauseTween(identifier: string) {\n const tween = this._tweens.get(identifier);\n if (!tween || !tween.isPlaying() || tween.hasFinished()) {\n return;\n }\n this._removeActiveTween(tween);\n tween.pause();\n }\n\n /**\n * Resume a tween.\n * @param identifier Unique id to identify the tween\n */\n resumeTween(identifier: string) {\n const tween = this._tweens.get(identifier);\n if (!tween || tween.isPlaying() || tween.hasFinished()) {\n return;\n }\n this._addActiveTween(tween);\n tween.resume();\n }\n\n /**\n * Stop a tween.\n * @param identifier Unique id to identify the tween\n * @param jumpToDest Move to destination\n */\n stopTween(identifier: string, jumpToDest: boolean) {\n const tween = this._tweens.get(identifier);\n if (!tween || tween.hasFinished()) {\n return;\n }\n if (tween.isPlaying()) {\n this._removeActiveTween(tween);\n }\n tween.stop(jumpToDest);\n }\n\n /**\n * Remove a tween.\n * @param identifier Unique id to identify the tween\n */\n removeTween(identifier: string) {\n const tween = this._tweens.get(identifier);\n if (!tween) {\n return;\n }\n if (tween.isPlaying()) {\n this._removeActiveTween(tween);\n }\n this._tweens.delete(identifier);\n }\n\n _addActiveTween(tween: TweenInstance): void {\n this._activeTweens.push(tween);\n }\n\n _removeActiveTween(tween: TweenInstance): void {\n const index = this._activeTweens.findIndex(\n (activeTween) => activeTween === tween\n );\n this._activeTweens.splice(index, 1);\n }\n\n /**\n * Get tween progress.\n * @param identifier Unique id to identify the tween\n * @returns Progress of playing tween animation (between 0.0 and 1.0)\n */\n getProgress(identifier: string): float {\n const tween = this._tweens.get(identifier);\n if (!tween) {\n return 0;\n }\n return tween.getProgress();\n }\n\n /**\n * Get tween value.\n *\n * It returns 0 for tweens with several values.\n *\n * @param identifier Unique id to identify the tween\n * @returns Value of playing tween animation\n */\n getValue(identifier: string): float {\n const tween = this._tweens.get(identifier);\n if (!tween) {\n return 0;\n }\n return tween.getValue();\n }\n }\n\n export interface TimeSource {\n getElapsedTime(): float;\n }\n\n /**\n * An interpolation function.\n * @ignore\n */\n export type Interpolation = (\n from: float,\n to: float,\n progress: float\n ) => float;\n\n const noEffect = () => {};\n\n /**\n * A tween.\n * @ignore\n */\n export interface TweenInstance {\n /**\n * Step toward the end.\n * @param timeDelta the duration from the previous step in seconds\n * @param layoutTimeDelta the duration from the previous step ignoring layer time scale in seconds\n */\n step(): void;\n isPlaying(): boolean;\n hasFinished(): boolean;\n stop(jumpToDest: boolean): void;\n resume(): void;\n pause(): void;\n getProgress(): float;\n getValue(): float;\n }\n\n /**\n * A tween.\n * @ignore\n */\n export abstract class AbstractTweenInstance implements TweenInstance {\n protected elapsedTime: float;\n protected totalDuration: float;\n protected easing: (progress: float) => float;\n protected interpolate: Interpolation;\n protected onFinish: () => void;\n protected timeSource: TimeSource;\n protected isPaused = false;\n\n constructor(\n timeSource: TimeSource,\n totalDuration: float,\n easing: (progress: float) => float,\n interpolate: Interpolation,\n onFinish?: (() => void) | null\n ) {\n this.timeSource = timeSource;\n this.totalDuration = totalDuration;\n this.easing = easing;\n this.interpolate = interpolate;\n this.elapsedTime = 0;\n this.onFinish = onFinish || noEffect;\n }\n\n step(): void {\n if (!this.isPlaying()) {\n return;\n }\n this.elapsedTime = Math.min(\n this.elapsedTime + this.timeSource.getElapsedTime() / 1000,\n this.totalDuration\n );\n this._updateValue();\n }\n\n protected abstract _updateValue(): void;\n abstract getValue(): float;\n\n isPlaying(): boolean {\n return !this.isPaused && !this.hasFinished();\n }\n\n hasFinished(): boolean {\n return this.elapsedTime === this.totalDuration;\n }\n\n stop(jumpToDest: boolean): void {\n this.elapsedTime = this.totalDuration;\n if (jumpToDest) {\n this._updateValue();\n }\n }\n\n resume(): void {\n this.isPaused = false;\n }\n\n pause(): void {\n this.isPaused = true;\n }\n\n getProgress(): float {\n return this.elapsedTime / this.totalDuration;\n }\n }\n\n /**\n * A tween with only one value.\n * @ignore\n */\n export class SimpleTweenInstance extends AbstractTweenInstance {\n initialValue: float;\n targetedValue: float;\n setValue: (value: float) => void;\n currentValue: float;\n\n constructor(\n timeSource: TimeSource,\n totalDuration: float,\n easing: (progress: float) => float,\n interpolate: Interpolation,\n initialValue: float,\n targetedValue: float,\n setValue: (value: float) => void,\n onFinish?: (() => void) | null\n ) {\n super(timeSource, totalDuration, easing, interpolate, onFinish);\n this.initialValue = initialValue;\n this.currentValue = initialValue;\n this.targetedValue = targetedValue;\n this.setValue = setValue;\n }\n\n protected _updateValue() {\n const easedProgress = this.easing(this.getProgress());\n const value = this.interpolate(\n this.initialValue,\n this.targetedValue,\n easedProgress\n );\n this.currentValue = value;\n this.setValue(value);\n if (this.hasFinished()) {\n this.onFinish();\n }\n }\n\n getValue(): float {\n return this.currentValue;\n }\n }\n\n /**\n * A tween with multiple values.\n * @ignore\n */\n export class MultiTweenInstance extends AbstractTweenInstance {\n initialValue: Array<float>;\n targetedValue: Array<float>;\n setValue: (value: Array<float>) => void;\n\n currentValues = new Array<float>();\n\n constructor(\n timeSource: TimeSource,\n totalDuration: float,\n easing: (progress: float) => float,\n interpolate: Interpolation,\n initialValue: Array<float>,\n targetedValue: Array<float>,\n setValue: (value: Array<float>) => void,\n onFinish?: (() => void) | null\n ) {\n super(timeSource, totalDuration, easing, interpolate, onFinish);\n this.initialValue = initialValue;\n this.targetedValue = targetedValue;\n this.setValue = setValue;\n }\n\n protected _updateValue() {\n const easedProgress = this.easing(this.getProgress());\n const length = this.initialValue.length;\n this.currentValues.length = length;\n for (let index = 0; index < length; index++) {\n this.currentValues[index] = this.interpolate(\n this.initialValue[index],\n this.targetedValue[index],\n easedProgress\n );\n }\n this.setValue(this.currentValues);\n if (this.hasFinished()) {\n this.onFinish();\n }\n }\n\n getValue(): float {\n return 0;\n }\n }\n\n export const rgbToHsl = (r: number, g: number, b: number): number[] => {\n r /= 255;\n g /= 255;\n b /= 255;\n let v = Math.max(r, g, b),\n c = v - Math.min(r, g, b),\n f = 1 - Math.abs(v + v - c - 1);\n let h =\n c &&\n (v === r ? (g - b) / c : v === g ? 2 + (b - r) / c : 4 + (r - g) / c);\n return [\n Math.round(60 * (h < 0 ? h + 6 : h)),\n Math.round((f ? c / f : 0) * 100),\n Math.round(((v + v - c) / 2) * 100),\n ];\n };\n\n export const hslToRgb = (h: number, s: number, l: number): number[] => {\n h = h %= 360;\n if (h < 0) {\n h += 360;\n }\n s = s / 100;\n l = l / 100;\n const a = s * Math.min(l, 1 - l);\n const f = (n = 0, k = (n + h / 30) % 12) =>\n l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n return [\n Math.round(f(0) * 255),\n Math.round(f(8) * 255),\n Math.round(f(4) * 255),\n ];\n };\n\n /**\n * Tween between 2 values according to an easing function.\n * @param fromValue Start value\n * @param toValue End value\n * @param easingValue Type of easing\n * @param weighting from 0 to 1\n */\n export const ease = (\n easingValue: string,\n fromValue: float,\n toValue: float,\n weighting: float\n ) => {\n // This local declaration is needed because otherwise the transpiled\n // code doesn't know it.\n const easingFunctions = gdjs.evtTools.tween.easingFunctions;\n\n const easingFunction = easingFunctions.hasOwnProperty(easingValue)\n ? easingFunctions[easingValue]\n : easingFunctions.linear;\n return fromValue + (toValue - fromValue) * easingFunction(weighting);\n };\n\n export type EasingFunction = (progress: float) => float;\n\n /*!\n * All equations are adapted from Thomas Fuchs'\n * [Scripty2](https://github.com/madrobby/scripty2/blob/master/src/effects/transitions/penner.js).\n *\n * Based on Easing Equations (c) 2003 [Robert\n * Penner](http://www.robertpenner.com/), all rights reserved. This work is\n * [subject to terms](http://www.robertpenner.com/easing_terms_of_use.html).\n */\n\n /*!\n * TERMS OF USE - EASING EQUATIONS\n * Open source under the BSD License.\n * Easing Equations (c) 2003 Robert Penner, all rights reserved.\n */\n\n /*! Shifty 3.0.3 - https://github.com/jeremyckahn/shifty */\n export const easingFunctions: Record<string, EasingFunction> = {\n linear: (pos: number) => pos,\n\n easeInQuad: (pos: number) => Math.pow(pos, 2),\n\n easeOutQuad: (pos: number) => -(Math.pow(pos - 1, 2) - 1),\n\n easeInOutQuad: (pos: number) =>\n (pos /= 0.5) < 1\n ? 0.5 * Math.pow(pos, 2)\n : -0.5 * ((pos -= 2) * pos - 2),\n\n easeInCubic: (pos: number) => Math.pow(pos, 3),\n\n easeOutCubic: (pos: number) => Math.pow(pos - 1, 3) + 1,\n\n easeInOutCubic: (pos: number) =>\n (pos /= 0.5) < 1\n ? 0.5 * Math.pow(pos, 3)\n : 0.5 * (Math.pow(pos - 2, 3) + 2),\n\n easeInQuart: (pos: number) => Math.pow(pos, 4),\n\n easeOutQuart: (pos: number) => -(Math.pow(pos - 1, 4) - 1),\n\n easeInOutQuart: (pos: number) =>\n (pos /= 0.5) < 1\n ? 0.5 * Math.pow(pos, 4)\n : -0.5 * ((pos -= 2) * Math.pow(pos, 3) - 2),\n\n easeInQuint: (pos: number) => Math.pow(pos, 5),\n\n easeOutQuint: (pos: number) => Math.pow(pos - 1, 5) + 1,\n\n easeInOutQuint: (pos: number) =>\n (pos /= 0.5) < 1\n ? 0.5 * Math.pow(pos, 5)\n : 0.5 * (Math.pow(pos - 2, 5) + 2),\n\n easeInSine: (pos: number) => -Math.cos(pos * (Math.PI / 2)) + 1,\n\n easeOutSine: (pos: number) => Math.sin(pos * (Math.PI / 2)),\n\n easeInOutSine: (pos: number) => -0.5 * (Math.cos(Math.PI * pos) - 1),\n\n easeInExpo: (pos: number) =>\n pos === 0 ? 0 : Math.pow(2, 10 * (pos - 1)),\n\n easeOutExpo: (pos: number) =>\n pos === 1 ? 1 : -Math.pow(2, -10 * pos) + 1,\n\n easeInOutExpo: (pos: number) => {\n if (pos === 0) {\n return 0;\n }\n\n if (pos === 1) {\n return 1;\n }\n\n if ((pos /= 0.5) < 1) {\n return 0.5 * Math.pow(2, 10 * (pos - 1));\n }\n\n return 0.5 * (-Math.pow(2, -10 * --pos) + 2);\n },\n\n easeInCirc: (pos: number) => -(Math.sqrt(1 - pos * pos) - 1),\n\n easeOutCirc: (pos: number) => Math.sqrt(1 - Math.pow(pos - 1, 2)),\n\n easeInOutCirc: (pos: number) =>\n (pos /= 0.5) < 1\n ? -0.5 * (Math.sqrt(1 - pos * pos) - 1)\n : 0.5 * (Math.sqrt(1 - (pos -= 2) * pos) + 1),\n\n easeOutBounce: (pos: number) => {\n if (pos < 1 / 2.75) {\n return 7.5625 * pos * pos;\n } else if (pos < 2 / 2.75) {\n return 7.5625 * (pos -= 1.5 / 2.75) * pos + 0.75;\n } else if (pos < 2.5 / 2.75) {\n return 7.5625 * (pos -= 2.25 / 2.75) * pos + 0.9375;\n } else {\n return 7.5625 * (pos -= 2.625 / 2.75) * pos + 0.984375;\n }\n },\n\n easeInBack: (pos: number) => {\n const s = 1.70158;\n return pos * pos * ((s + 1) * pos - s);\n },\n\n easeOutBack: (pos: number) => {\n const s = 1.70158;\n return (pos = pos - 1) * pos * ((s + 1) * pos + s) + 1;\n },\n\n easeInOutBack: (pos: number) => {\n let s = 1.70158;\n if ((pos /= 0.5) < 1) {\n return 0.5 * (pos * pos * (((s *= 1.525) + 1) * pos - s));\n }\n return 0.5 * ((pos -= 2) * pos * (((s *= 1.525) + 1) * pos + s) + 2);\n },\n\n elastic: (pos: number) =>\n -1 *\n Math.pow(4, -8 * pos) *\n Math.sin(((pos * 6 - 1) * (2 * Math.PI)) / 2) +\n 1,\n\n swingFromTo: (pos: number) => {\n let s = 1.70158;\n return (pos /= 0.5) < 1\n ? 0.5 * (pos * pos * (((s *= 1.525) + 1) * pos - s))\n : 0.5 * ((pos -= 2) * pos * (((s *= 1.525) + 1) * pos + s) + 2);\n },\n\n swingFrom: (pos: number) => {\n const s = 1.70158;\n return pos * pos * ((s + 1) * pos - s);\n },\n\n swingTo: (pos: number) => {\n const s = 1.70158;\n return (pos -= 1) * pos * ((s + 1) * pos + s) + 1;\n },\n\n bounce: (pos: number) => {\n if (pos < 1 / 2.75) {\n return 7.5625 * pos * pos;\n } else if (pos < 2 / 2.75) {\n return 7.5625 * (pos -= 1.5 / 2.75) * pos + 0.75;\n } else if (pos < 2.5 / 2.75) {\n return 7.5625 * (pos -= 2.25 / 2.75) * pos + 0.9375;\n } else {\n return 7.5625 * (pos -= 2.625 / 2.75) * pos + 0.984375;\n }\n },\n\n bouncePast: (pos: number) => {\n if (pos < 1 / 2.75) {\n return 7.5625 * pos * pos;\n } else if (pos < 2 / 2.75) {\n return 2 - (7.5625 * (pos -= 1.5 / 2.75) * pos + 0.75);\n } else if (pos < 2.5 / 2.75) {\n return 2 - (7.5625 * (pos -= 2.25 / 2.75) * pos + 0.9375);\n } else {\n return 2 - (7.5625 * (pos -= 2.625 / 2.75) * pos + 0.984375);\n }\n },\n\n easeFromTo: (pos: number) =>\n (pos /= 0.5) < 1\n ? 0.5 * Math.pow(pos, 4)\n : -0.5 * ((pos -= 2) * Math.pow(pos, 3) - 2),\n\n easeFrom: (pos: number) => Math.pow(pos, 4),\n\n easeTo: (pos: number) => Math.pow(pos, 0.25),\n };\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACS,GAAU,GAAV,UAAU,EAAV,CACE,GAAU,GAAV,UAAU,EAAV,
|
|
4
|
+
"sourcesContent": ["namespace gdjs {\n export namespace evtTools {\n export namespace tween {\n /*!\n * All equations are adapted from Thomas Fuchs'\n * [Scripty2](https://github.com/madrobby/scripty2/blob/master/src/effects/transitions/penner.js).\n *\n * Based on Easing Equations (c) 2003 [Robert\n * Penner](http://www.robertpenner.com/), all rights reserved. This work is\n * [subject to terms](http://www.robertpenner.com/easing_terms_of_use.html).\n */\n\n /*!\n * TERMS OF USE - EASING EQUATIONS\n * Open source under the BSD License.\n * Easing Equations (c) 2003 Robert Penner, all rights reserved.\n */\n\n /*! Shifty 3.0.3 - https://github.com/jeremyckahn/shifty */\n export const easingFunctions: Record<string, EasingFunction> = {\n linear: (pos: number) => pos,\n\n easeInQuad: (pos: number) => Math.pow(pos, 2),\n\n easeOutQuad: (pos: number) => -(Math.pow(pos - 1, 2) - 1),\n\n easeInOutQuad: (pos: number) =>\n (pos /= 0.5) < 1\n ? 0.5 * Math.pow(pos, 2)\n : -0.5 * ((pos -= 2) * pos - 2),\n\n easeInCubic: (pos: number) => Math.pow(pos, 3),\n\n easeOutCubic: (pos: number) => Math.pow(pos - 1, 3) + 1,\n\n easeInOutCubic: (pos: number) =>\n (pos /= 0.5) < 1\n ? 0.5 * Math.pow(pos, 3)\n : 0.5 * (Math.pow(pos - 2, 3) + 2),\n\n easeInQuart: (pos: number) => Math.pow(pos, 4),\n\n easeOutQuart: (pos: number) => -(Math.pow(pos - 1, 4) - 1),\n\n easeInOutQuart: (pos: number) =>\n (pos /= 0.5) < 1\n ? 0.5 * Math.pow(pos, 4)\n : -0.5 * ((pos -= 2) * Math.pow(pos, 3) - 2),\n\n easeInQuint: (pos: number) => Math.pow(pos, 5),\n\n easeOutQuint: (pos: number) => Math.pow(pos - 1, 5) + 1,\n\n easeInOutQuint: (pos: number) =>\n (pos /= 0.5) < 1\n ? 0.5 * Math.pow(pos, 5)\n : 0.5 * (Math.pow(pos - 2, 5) + 2),\n\n easeInSine: (pos: number) => -Math.cos(pos * (Math.PI / 2)) + 1,\n\n easeOutSine: (pos: number) => Math.sin(pos * (Math.PI / 2)),\n\n easeInOutSine: (pos: number) => -0.5 * (Math.cos(Math.PI * pos) - 1),\n\n easeInExpo: (pos: number) =>\n pos === 0 ? 0 : Math.pow(2, 10 * (pos - 1)),\n\n easeOutExpo: (pos: number) =>\n pos === 1 ? 1 : -Math.pow(2, -10 * pos) + 1,\n\n easeInOutExpo: (pos: number) => {\n if (pos === 0) {\n return 0;\n }\n\n if (pos === 1) {\n return 1;\n }\n\n if ((pos /= 0.5) < 1) {\n return 0.5 * Math.pow(2, 10 * (pos - 1));\n }\n\n return 0.5 * (-Math.pow(2, -10 * --pos) + 2);\n },\n\n easeInCirc: (pos: number) => -(Math.sqrt(1 - pos * pos) - 1),\n\n easeOutCirc: (pos: number) => Math.sqrt(1 - Math.pow(pos - 1, 2)),\n\n easeInOutCirc: (pos: number) =>\n (pos /= 0.5) < 1\n ? -0.5 * (Math.sqrt(1 - pos * pos) - 1)\n : 0.5 * (Math.sqrt(1 - (pos -= 2) * pos) + 1),\n\n easeOutBounce: (pos: number) => {\n if (pos < 1 / 2.75) {\n return 7.5625 * pos * pos;\n } else if (pos < 2 / 2.75) {\n return 7.5625 * (pos -= 1.5 / 2.75) * pos + 0.75;\n } else if (pos < 2.5 / 2.75) {\n return 7.5625 * (pos -= 2.25 / 2.75) * pos + 0.9375;\n } else {\n return 7.5625 * (pos -= 2.625 / 2.75) * pos + 0.984375;\n }\n },\n\n easeInBack: (pos: number) => {\n const s = 1.70158;\n return pos * pos * ((s + 1) * pos - s);\n },\n\n easeOutBack: (pos: number) => {\n const s = 1.70158;\n return (pos = pos - 1) * pos * ((s + 1) * pos + s) + 1;\n },\n\n easeInOutBack: (pos: number) => {\n let s = 1.70158;\n if ((pos /= 0.5) < 1) {\n return 0.5 * (pos * pos * (((s *= 1.525) + 1) * pos - s));\n }\n return 0.5 * ((pos -= 2) * pos * (((s *= 1.525) + 1) * pos + s) + 2);\n },\n\n elastic: (pos: number) =>\n -1 *\n Math.pow(4, -8 * pos) *\n Math.sin(((pos * 6 - 1) * (2 * Math.PI)) / 2) +\n 1,\n\n swingFromTo: (pos: number) => {\n let s = 1.70158;\n return (pos /= 0.5) < 1\n ? 0.5 * (pos * pos * (((s *= 1.525) + 1) * pos - s))\n : 0.5 * ((pos -= 2) * pos * (((s *= 1.525) + 1) * pos + s) + 2);\n },\n\n swingFrom: (pos: number) => {\n const s = 1.70158;\n return pos * pos * ((s + 1) * pos - s);\n },\n\n swingTo: (pos: number) => {\n const s = 1.70158;\n return (pos -= 1) * pos * ((s + 1) * pos + s) + 1;\n },\n\n bounce: (pos: number) => {\n if (pos < 1 / 2.75) {\n return 7.5625 * pos * pos;\n } else if (pos < 2 / 2.75) {\n return 7.5625 * (pos -= 1.5 / 2.75) * pos + 0.75;\n } else if (pos < 2.5 / 2.75) {\n return 7.5625 * (pos -= 2.25 / 2.75) * pos + 0.9375;\n } else {\n return 7.5625 * (pos -= 2.625 / 2.75) * pos + 0.984375;\n }\n },\n\n bouncePast: (pos: number) => {\n if (pos < 1 / 2.75) {\n return 7.5625 * pos * pos;\n } else if (pos < 2 / 2.75) {\n return 2 - (7.5625 * (pos -= 1.5 / 2.75) * pos + 0.75);\n } else if (pos < 2.5 / 2.75) {\n return 2 - (7.5625 * (pos -= 2.25 / 2.75) * pos + 0.9375);\n } else {\n return 2 - (7.5625 * (pos -= 2.625 / 2.75) * pos + 0.984375);\n }\n },\n\n easeFromTo: (pos: number) =>\n (pos /= 0.5) < 1\n ? 0.5 * Math.pow(pos, 4)\n : -0.5 * ((pos -= 2) * Math.pow(pos, 3) - 2),\n\n easeFrom: (pos: number) => Math.pow(pos, 4),\n\n easeTo: (pos: number) => Math.pow(pos, 0.25),\n };\n\n type GetTimeSourceFunction = (\n tweenInformationNetworkSyncData: TweenInformationNetworkSyncData\n ) => TimeSource;\n type GetTweenSetterFunction = (\n tweenInformationNetworkSyncData: TweenInformationNetworkSyncData\n ) => (value: any) => void;\n type GetOnFinishFunction = (\n tweenInformationNetworkSyncData: TweenInformationNetworkSyncData\n ) => (() => void) | null;\n\n /**\n * A tween manager that is used for layout tweens or object tweens.\n * @ignore\n */\n export class TweenManager {\n /**\n * All the tweens of a layout or a behavior.\n */\n private _tweens = new Map<\n string,\n TweenInstance<float> | TweenInstance<Array<float>>\n >();\n /**\n * Allow fast iteration on tween that are active.\n */\n private _activeTweens = new Array<\n TweenInstance<float> | TweenInstance<Array<float>>\n >();\n\n constructor() {}\n\n /**\n * Make all active tween step toward the end.\n * @param timeDelta the duration from the previous step in seconds\n * @param layoutTimeDelta the duration from the previous step ignoring layer time scale in seconds\n */\n step(): void {\n let writeIndex = 0;\n for (\n let readIndex = 0;\n readIndex < this._activeTweens.length;\n readIndex++\n ) {\n const tween = this._activeTweens[readIndex];\n\n tween.step();\n if (!tween.hasFinished()) {\n this._activeTweens[writeIndex] = tween;\n writeIndex++;\n }\n }\n this._activeTweens.length = writeIndex;\n }\n\n /**\n * Add a tween on one value.\n */\n addSimpleTween(\n identifier: string,\n timeSource: TimeSource,\n totalDuration: number,\n easingIdentifier: string,\n interpolate: Interpolation,\n initialValue: float,\n targetedValue: float,\n setValue: (value: float) => void,\n tweenInformation: TweenInformation,\n onFinish?: (() => void) | null\n ): void {\n const easing = easingFunctions[easingIdentifier];\n if (!easing) return;\n\n // Remove any prior tween\n this.removeTween(identifier);\n\n // Initialize the tween instance\n const tween = new SimpleTweenInstance(\n timeSource,\n totalDuration,\n easing,\n easingIdentifier,\n interpolate,\n initialValue,\n targetedValue,\n setValue,\n tweenInformation,\n onFinish\n ) as TweenInstance<number>;\n this._tweens.set(identifier, tween);\n this._addActiveTween(tween);\n }\n\n /**\n * Add a tween on several values.\n */\n addMultiTween(\n identifier: string,\n timeSource: TimeSource,\n totalDuration: number,\n easingIdentifier: string,\n interpolate: Interpolation,\n initialValue: Array<float>,\n targetedValue: Array<float>,\n setValue: (value: Array<float>) => void,\n tweenInformation: TweenInformation,\n onFinish?: (() => void) | null\n ): void {\n const easing = easingFunctions[easingIdentifier];\n if (!easing) return;\n\n // Remove any prior tween\n this.removeTween(identifier);\n\n // Initialize the tween instance\n const tween = new MultiTweenInstance(\n timeSource,\n totalDuration,\n easing,\n easingIdentifier,\n interpolate,\n initialValue,\n targetedValue,\n setValue,\n tweenInformation,\n onFinish\n );\n this._tweens.set(identifier, tween);\n this._addActiveTween(tween);\n }\n\n /**\n * Tween exists.\n * @param identifier Unique id to identify the tween\n * @returns The tween exists\n */\n exists(identifier: string): boolean {\n return this._tweens.has(identifier);\n }\n\n /**\n * Tween is playing.\n * @param identifier Unique id to identify the tween\n */\n isPlaying(identifier: string): boolean {\n const tween = this._tweens.get(identifier);\n return !!tween && tween.isPlaying();\n }\n\n /**\n * Tween has finished.\n * @param identifier Unique id to identify the tween\n */\n hasFinished(identifier: string): boolean {\n const tween = this._tweens.get(identifier);\n return !!tween && tween.hasFinished();\n }\n\n /**\n * Pause a tween.\n * @param identifier Unique id to identify the tween\n */\n pauseTween(identifier: string) {\n const tween = this._tweens.get(identifier);\n if (!tween || !tween.isPlaying() || tween.hasFinished()) {\n return;\n }\n this._removeActiveTween(tween);\n tween.pause();\n }\n\n /**\n * Resume a tween.\n * @param identifier Unique id to identify the tween\n */\n resumeTween(identifier: string) {\n const tween = this._tweens.get(identifier);\n if (!tween || tween.isPlaying() || tween.hasFinished()) {\n return;\n }\n this._addActiveTween(tween);\n tween.resume();\n }\n\n /**\n * Stop a tween.\n * @param identifier Unique id to identify the tween\n * @param jumpToDest Move to destination\n */\n stopTween(identifier: string, jumpToDest: boolean) {\n const tween = this._tweens.get(identifier);\n if (!tween || tween.hasFinished()) {\n return;\n }\n if (tween.isPlaying()) {\n this._removeActiveTween(tween);\n }\n tween.stop(jumpToDest);\n }\n\n /**\n * Remove a tween.\n * @param identifier Unique id to identify the tween\n */\n removeTween(identifier: string) {\n const tween = this._tweens.get(identifier);\n if (!tween) {\n return;\n }\n if (tween.isPlaying()) {\n this._removeActiveTween(tween);\n }\n this._tweens.delete(identifier);\n }\n\n _addActiveTween(\n tween: TweenInstance<float> | TweenInstance<Array<float>>\n ): void {\n this._activeTweens.push(tween);\n }\n\n _removeActiveTween(\n tween: TweenInstance<float> | TweenInstance<Array<float>>\n ): void {\n const index = this._activeTweens.findIndex(\n (activeTween) => activeTween === tween\n );\n this._activeTweens.splice(index, 1);\n }\n\n /**\n * Get tween progress.\n * @param identifier Unique id to identify the tween\n * @returns Progress of playing tween animation (between 0.0 and 1.0)\n */\n getProgress(identifier: string): float {\n const tween = this._tweens.get(identifier);\n if (!tween) {\n return 0;\n }\n return tween.getProgress();\n }\n\n /**\n * Get tween value.\n *\n * It returns 0 for tweens with several values.\n *\n * @param identifier Unique id to identify the tween\n * @returns Value of playing tween animation\n */\n getValue(identifier: string): float {\n const tween = this._tweens.get(identifier);\n if (!tween) {\n return 0;\n }\n return tween.getValue();\n }\n\n getNetworkSyncData(): TweenManagerNetworkSyncData {\n const syncData = {\n tweens: {},\n };\n this._tweens.forEach((tween, identifier) => {\n syncData.tweens[identifier] = tween.getNetworkSyncData();\n });\n return syncData;\n }\n\n updateFromNetworkSyncData(\n syncData: TweenManagerNetworkSyncData,\n getTimeSource: GetTimeSourceFunction,\n getTweenSetter: GetTweenSetterFunction,\n getOnFinish: GetOnFinishFunction\n ) {\n Object.entries(syncData.tweens).forEach(\n ([identifier, tweenSyncData]) => {\n const timeSource = getTimeSource(tweenSyncData.tweenInformation);\n const setValue = getTweenSetter(tweenSyncData.tweenInformation);\n const onFinish = getOnFinish(tweenSyncData.tweenInformation);\n const interpolation =\n tweenSyncData.interpolationString === 'exponential'\n ? gdjs.evtTools.common.exponentialInterpolation\n : gdjs.evtTools.common.lerp;\n const tweenInformation: TweenInformation = {\n type: tweenSyncData.tweenInformation.type,\n layerName: tweenSyncData.tweenInformation.layerName,\n effectName: tweenSyncData.tweenInformation.effectName,\n propertyName: tweenSyncData.tweenInformation.propertyName,\n scaleFromCenterOfObject:\n tweenSyncData.tweenInformation.scaleFromCenterOfObject,\n useHSLColorTransition:\n tweenSyncData.tweenInformation.useHSLColorTransition,\n destroyObjectWhenFinished:\n tweenSyncData.tweenInformation.destroyObjectWhenFinished,\n };\n\n if (\n tweenSyncData.tweenInformation.variablePath &&\n (timeSource instanceof gdjs.RuntimeScene ||\n timeSource instanceof gdjs.RuntimeObject)\n ) {\n const variable = timeSource\n .getVariables()\n .getVariableFromPath(\n tweenSyncData.tweenInformation.variablePath\n );\n if (variable) {\n tweenInformation.variable = variable;\n }\n }\n\n if (\n typeof tweenSyncData.initialValue === 'number' &&\n typeof tweenSyncData.targetedValue === 'number'\n ) {\n this.addSimpleTween(\n identifier,\n timeSource,\n tweenSyncData.totalDuration,\n tweenSyncData.easingIdentifier,\n interpolation,\n tweenSyncData.initialValue,\n tweenSyncData.targetedValue,\n setValue,\n tweenInformation,\n onFinish\n );\n\n // Restore tween state\n const tween = this._tweens.get(identifier);\n if (tween) {\n tween.updateElapsedTime(tweenSyncData.elapsedTime);\n if (tweenSyncData.isPaused) {\n this.pauseTween(identifier);\n }\n }\n } else if (\n Array.isArray(tweenSyncData.initialValue) &&\n Array.isArray(tweenSyncData.targetedValue)\n ) {\n this.addMultiTween(\n identifier,\n timeSource,\n tweenSyncData.totalDuration,\n tweenSyncData.easingIdentifier,\n interpolation,\n tweenSyncData.initialValue,\n tweenSyncData.targetedValue,\n setValue,\n tweenInformation,\n onFinish\n );\n\n // Restore tween state\n const tween = this._tweens.get(identifier);\n if (tween) {\n tween.updateElapsedTime(tweenSyncData.elapsedTime);\n if (tweenSyncData.isPaused) {\n this.pauseTween(identifier);\n }\n }\n }\n }\n );\n }\n }\n\n export interface TimeSource {\n getElapsedTime(): float;\n }\n\n /**\n * An interpolation function.\n * @ignore\n */\n export type Interpolation = (\n from: float,\n to: float,\n progress: float\n ) => float;\n\n const noEffect = () => {};\n\n /**\n * A tween.\n * @ignore\n */\n export interface TweenInstance<T> {\n /**\n * Step toward the end.\n * @param timeDelta the duration from the previous step in seconds\n * @param layoutTimeDelta the duration from the previous step ignoring layer time scale in seconds\n */\n step(): void;\n isPlaying(): boolean;\n hasFinished(): boolean;\n stop(jumpToDest: boolean): void;\n resume(): void;\n pause(): void;\n getProgress(): float;\n getValue(): float;\n getNetworkSyncData(): TweenInstanceNetworkSyncData<T>;\n updateElapsedTime(newElapsedTime: float): void;\n }\n\n /**\n * A tween.\n * @ignore\n */\n export abstract class AbstractTweenInstance<T>\n implements TweenInstance<T>\n {\n protected elapsedTime: float;\n protected totalDuration: float;\n protected easing: (progress: float) => float;\n protected easingIdentifier: string;\n protected interpolate: Interpolation;\n protected onFinish: () => void;\n protected timeSource: TimeSource;\n protected isPaused = false;\n protected tweenInformation: TweenInformation;\n\n constructor(\n timeSource: TimeSource,\n totalDuration: float,\n easing: (progress: float) => float,\n easingIdentifier: string,\n interpolate: Interpolation,\n tweenInformation: TweenInformation,\n onFinish?: (() => void) | null\n ) {\n this.timeSource = timeSource;\n this.totalDuration = totalDuration;\n this.easing = easing;\n this.easingIdentifier = easingIdentifier;\n this.interpolate = interpolate;\n this.tweenInformation = tweenInformation;\n this.elapsedTime = 0;\n this.onFinish = onFinish || noEffect;\n }\n\n step(): void {\n if (!this.isPlaying()) {\n return;\n }\n this.elapsedTime = Math.min(\n this.elapsedTime + this.timeSource.getElapsedTime() / 1000,\n this.totalDuration\n );\n this._updateValue();\n }\n\n protected abstract _updateValue(): void;\n abstract getValue(): float;\n\n isPlaying(): boolean {\n return !this.isPaused && !this.hasFinished();\n }\n\n hasFinished(): boolean {\n return this.elapsedTime === this.totalDuration;\n }\n\n stop(jumpToDest: boolean): void {\n this.elapsedTime = this.totalDuration;\n if (jumpToDest) {\n this._updateValue();\n }\n }\n\n resume(): void {\n this.isPaused = false;\n }\n\n pause(): void {\n this.isPaused = true;\n }\n\n getProgress(): float {\n return this.elapsedTime / this.totalDuration;\n }\n\n // To be used for network synchronization.\n updateElapsedTime(newElapsedTime: float): void {\n this.elapsedTime = newElapsedTime;\n }\n\n abstract getNetworkSyncData(): TweenInstanceNetworkSyncData<T>;\n // No updateFromNetworkSyncData, as a tween is recreated on sync.\n }\n\n /**\n * A tween with only one value.\n * @ignore\n */\n export class SimpleTweenInstance extends AbstractTweenInstance<float> {\n initialValue: float;\n targetedValue: float;\n setValue: (value: float) => void;\n currentValue: float;\n\n constructor(\n timeSource: TimeSource,\n totalDuration: float,\n easing: (progress: float) => float,\n easingIdentifier: string,\n interpolate: Interpolation,\n initialValue: float,\n targetedValue: float,\n setValue: (value: float) => void,\n tweenInformation: TweenInformation,\n onFinish?: (() => void) | null\n ) {\n super(\n timeSource,\n totalDuration,\n easing,\n easingIdentifier,\n interpolate,\n tweenInformation,\n onFinish\n );\n this.initialValue = initialValue;\n this.currentValue = initialValue;\n this.targetedValue = targetedValue;\n this.setValue = setValue;\n }\n\n protected _updateValue() {\n const easedProgress = this.easing(this.getProgress());\n const value = this.interpolate(\n this.initialValue,\n this.targetedValue,\n easedProgress\n );\n this.currentValue = value;\n this.setValue(value);\n if (this.hasFinished()) {\n this.onFinish();\n }\n }\n\n getValue(): float {\n return this.currentValue;\n }\n\n getNetworkSyncData(): TweenInstanceNetworkSyncData<float> {\n const interpolationString: 'exponential' | 'linear' =\n this.interpolate === gdjs.evtTools.common.exponentialInterpolation\n ? 'exponential'\n : 'linear';\n\n const tweenInformationNetworkSyncData: TweenInformationNetworkSyncData =\n {\n type: this.tweenInformation.type,\n layerName: this.tweenInformation.layerName,\n effectName: this.tweenInformation.effectName,\n propertyName: this.tweenInformation.propertyName,\n scaleFromCenterOfObject:\n this.tweenInformation.scaleFromCenterOfObject,\n useHSLColorTransition:\n this.tweenInformation.useHSLColorTransition,\n destroyObjectWhenFinished:\n this.tweenInformation.destroyObjectWhenFinished,\n };\n\n if (\n this.tweenInformation.variable &&\n (this.timeSource instanceof gdjs.RuntimeScene ||\n this.timeSource instanceof gdjs.RuntimeObject)\n ) {\n const variablePath = this.timeSource\n .getVariables()\n .getVariablePathInContainerByLoopingThroughAllVariables(\n this.tweenInformation.variable\n );\n if (variablePath) {\n tweenInformationNetworkSyncData.variablePath = variablePath;\n }\n }\n\n return {\n initialValue: this.initialValue,\n targetedValue: this.targetedValue,\n elapsedTime: this.elapsedTime,\n totalDuration: this.totalDuration,\n easingIdentifier: this.easingIdentifier,\n interpolationString,\n isPaused: this.isPaused,\n tweenInformation: tweenInformationNetworkSyncData,\n };\n }\n }\n\n /**\n * A tween with multiple values.\n * @ignore\n */\n export class MultiTweenInstance extends AbstractTweenInstance<\n Array<float>\n > {\n initialValue: Array<float>;\n targetedValue: Array<float>;\n setValue: (value: Array<float>) => void;\n\n currentValues = new Array<float>();\n\n constructor(\n timeSource: TimeSource,\n totalDuration: float,\n easing: (progress: float) => float,\n easingIdentifier: string,\n interpolate: Interpolation,\n initialValue: Array<float>,\n targetedValue: Array<float>,\n setValue: (value: Array<float>) => void,\n tweenInformation: TweenInformation,\n onFinish?: (() => void) | null\n ) {\n super(\n timeSource,\n totalDuration,\n easing,\n easingIdentifier,\n interpolate,\n tweenInformation,\n onFinish\n );\n this.initialValue = initialValue;\n this.targetedValue = targetedValue;\n this.setValue = setValue;\n }\n\n protected _updateValue() {\n const easedProgress = this.easing(this.getProgress());\n const length = this.initialValue.length;\n this.currentValues.length = length;\n for (let index = 0; index < length; index++) {\n this.currentValues[index] = this.interpolate(\n this.initialValue[index],\n this.targetedValue[index],\n easedProgress\n );\n }\n this.setValue(this.currentValues);\n if (this.hasFinished()) {\n this.onFinish();\n }\n }\n\n getValue(): float {\n return 0;\n }\n\n getNetworkSyncData(): TweenInstanceNetworkSyncData<Array<float>> {\n const interpolationString: 'exponential' | 'linear' =\n this.interpolate === gdjs.evtTools.common.exponentialInterpolation\n ? 'exponential'\n : 'linear';\n return {\n initialValue: this.initialValue,\n targetedValue: this.targetedValue,\n elapsedTime: this.elapsedTime,\n totalDuration: this.totalDuration,\n easingIdentifier: this.easingIdentifier,\n interpolationString,\n isPaused: this.isPaused,\n tweenInformation: this.tweenInformation,\n };\n }\n }\n\n export const rgbToHsl = (r: number, g: number, b: number): number[] => {\n r /= 255;\n g /= 255;\n b /= 255;\n let v = Math.max(r, g, b),\n c = v - Math.min(r, g, b),\n f = 1 - Math.abs(v + v - c - 1);\n let h =\n c &&\n (v === r ? (g - b) / c : v === g ? 2 + (b - r) / c : 4 + (r - g) / c);\n return [\n Math.round(60 * (h < 0 ? h + 6 : h)),\n Math.round((f ? c / f : 0) * 100),\n Math.round(((v + v - c) / 2) * 100),\n ];\n };\n\n export const hslToRgb = (h: number, s: number, l: number): number[] => {\n h = h %= 360;\n if (h < 0) {\n h += 360;\n }\n s = s / 100;\n l = l / 100;\n const a = s * Math.min(l, 1 - l);\n const f = (n = 0, k = (n + h / 30) % 12) =>\n l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n return [\n Math.round(f(0) * 255),\n Math.round(f(8) * 255),\n Math.round(f(4) * 255),\n ];\n };\n\n /**\n * Tween between 2 values according to an easing function.\n * @param fromValue Start value\n * @param toValue End value\n * @param easingValue Type of easing\n * @param weighting from 0 to 1\n */\n export const ease = (\n easingValue: string,\n fromValue: float,\n toValue: float,\n weighting: float\n ) => {\n // This local declaration is needed because otherwise the transpiled\n // code doesn't know it.\n const easingFunctions = gdjs.evtTools.tween.easingFunctions;\n\n const easingFunction = easingFunctions.hasOwnProperty(easingValue)\n ? easingFunctions[easingValue]\n : easingFunctions.linear;\n return fromValue + (toValue - fromValue) * easingFunction(weighting);\n };\n\n export type EasingFunction = (progress: float) => float;\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACS,GAAU,GAAV,UAAU,EAAV,CACE,GAAU,GAAV,UAAU,EAAV,CACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GASA;AAAA;AAAA;AAAA;AAAA,GAMA,2DACO,AAAM,kBAAkD,CAC7D,OAAQ,AA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