gdcore-tools 2.0.0-beta6 → 2.0.0-beta8

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.
Files changed (139) hide show
  1. package/dist/Runtime/Cordova/config.xml +4 -0
  2. package/dist/Runtime/Cordova/package.json +12 -20
  3. package/dist/Runtime/CustomRuntimeObject.js +1 -1
  4. package/dist/Runtime/CustomRuntimeObject.js.map +2 -2
  5. package/dist/Runtime/CustomRuntimeObjectInstanceContainer.js +1 -1
  6. package/dist/Runtime/CustomRuntimeObjectInstanceContainer.js.map +2 -2
  7. package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js +1 -1
  8. package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js.map +2 -2
  9. package/dist/Runtime/Extensions/3D/AmbientLight.js +1 -1
  10. package/dist/Runtime/Extensions/3D/AmbientLight.js.map +2 -2
  11. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js +1 -1
  12. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js.map +2 -2
  13. package/dist/Runtime/Extensions/3D/DirectionalLight.js +1 -1
  14. package/dist/Runtime/Extensions/3D/DirectionalLight.js.map +2 -2
  15. package/dist/Runtime/Extensions/3D/ExponentialFog.js +1 -1
  16. package/dist/Runtime/Extensions/3D/ExponentialFog.js.map +2 -2
  17. package/dist/Runtime/Extensions/3D/HemisphereLight.js +1 -1
  18. package/dist/Runtime/Extensions/3D/HemisphereLight.js.map +2 -2
  19. package/dist/Runtime/Extensions/3D/JsExtension.js +419 -228
  20. package/dist/Runtime/Extensions/3D/LinearFog.js +1 -1
  21. package/dist/Runtime/Extensions/3D/LinearFog.js.map +2 -2
  22. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js +1 -1
  23. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js.map +2 -2
  24. package/dist/Runtime/Extensions/AdvancedWindow/electron-advancedwindowtools.js +1 -1
  25. package/dist/Runtime/Extensions/AdvancedWindow/electron-advancedwindowtools.js.map +2 -2
  26. package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js +1 -1
  27. package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js.map +2 -2
  28. package/dist/Runtime/Extensions/BBText/JsExtension.js +45 -42
  29. package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js +1 -1
  30. package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
  31. package/dist/Runtime/Extensions/BitmapText/JsExtension.js +40 -49
  32. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js +1 -1
  33. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
  34. package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js +1 -1
  35. package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js.map +2 -2
  36. package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js +1 -1
  37. package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js.map +2 -2
  38. package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js +1 -1
  39. package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js.map +2 -2
  40. package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js +1 -1
  41. package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js.map +2 -2
  42. package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js +1 -1
  43. package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js.map +2 -2
  44. package/dist/Runtime/Extensions/ExampleJsExtension/JsExtension.js +18 -21
  45. package/dist/Runtime/Extensions/Firebase/B_firebasetools/C_firebasetools.js +1 -1
  46. package/dist/Runtime/Extensions/Firebase/B_firebasetools/C_firebasetools.js.map +2 -2
  47. package/dist/Runtime/Extensions/JsExtensionTypes.d.ts +8 -2
  48. package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js +1 -1
  49. package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js.map +2 -2
  50. package/dist/Runtime/Extensions/Lighting/JsExtension.js +50 -38
  51. package/dist/Runtime/Extensions/Lighting/lightruntimeobject-pixi-renderer.js +1 -1
  52. package/dist/Runtime/Extensions/Lighting/lightruntimeobject-pixi-renderer.js.map +2 -2
  53. package/dist/Runtime/Extensions/Multiplayer/JsExtension.js +15 -0
  54. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js +1 -1
  55. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +2 -2
  56. package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js.map +2 -2
  57. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js +1 -1
  58. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
  59. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js +1 -1
  60. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js.map +2 -2
  61. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js +1 -1
  62. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
  63. package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +76 -24
  64. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js +1 -1
  65. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
  66. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js +1 -1
  67. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js.map +2 -2
  68. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js +1 -1
  69. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
  70. package/dist/Runtime/Extensions/Spine/JsExtension.js +45 -36
  71. package/dist/Runtime/Extensions/Spine/spineruntimeobject.js +1 -1
  72. package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
  73. package/dist/Runtime/Extensions/TextInput/JsExtension.js +52 -55
  74. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js +1 -1
  75. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js.map +2 -2
  76. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js +1 -1
  77. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
  78. package/dist/Runtime/Extensions/TextObject/textruntimeobject-pixi-renderer.js +1 -1
  79. package/dist/Runtime/Extensions/TextObject/textruntimeobject-pixi-renderer.js.map +2 -2
  80. package/dist/Runtime/Extensions/TextObject/textruntimeobject.js +1 -1
  81. package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
  82. package/dist/Runtime/Extensions/TileMap/JsExtension.js +430 -261
  83. package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js +1 -1
  84. package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js.map +2 -2
  85. package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js +1 -1
  86. package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js.map +2 -2
  87. package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js +1 -1
  88. package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js.map +1 -1
  89. package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts.map +1 -1
  90. package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts +1 -0
  91. package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts.map +1 -1
  92. package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js +1 -1
  93. package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +2 -2
  94. package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js +1 -1
  95. package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
  96. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js +1 -1
  97. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
  98. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js +1 -1
  99. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
  100. package/dist/Runtime/Extensions/Video/JsExtension.js +35 -44
  101. package/dist/Runtime/Extensions/Video/videoruntimeobject.js +1 -1
  102. package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
  103. package/dist/Runtime/ResourceLoader.js +1 -1
  104. package/dist/Runtime/ResourceLoader.js.map +2 -2
  105. package/dist/Runtime/RuntimeInstanceContainer.js.map +2 -2
  106. package/dist/Runtime/debugger-client/hot-reloader.js +2 -2
  107. package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
  108. package/dist/Runtime/events-tools/inputtools.js +1 -1
  109. package/dist/Runtime/events-tools/inputtools.js.map +2 -2
  110. package/dist/Runtime/events-tools/objecttools.js +1 -1
  111. package/dist/Runtime/events-tools/objecttools.js.map +2 -2
  112. package/dist/Runtime/gd.js +1 -1
  113. package/dist/Runtime/gd.js.map +2 -2
  114. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js +1 -1
  115. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js.map +2 -2
  116. package/dist/Runtime/inputmanager.js +1 -1
  117. package/dist/Runtime/inputmanager.js.map +2 -2
  118. package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js +1 -1
  119. package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js.map +2 -2
  120. package/dist/Runtime/pixi-renderers/pixi-filters-tools.js +1 -1
  121. package/dist/Runtime/pixi-renderers/pixi-filters-tools.js.map +2 -2
  122. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js +1 -1
  123. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js.map +2 -2
  124. package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js +1 -1
  125. package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js.map +2 -2
  126. package/dist/Runtime/runtimegame.js +1 -1
  127. package/dist/Runtime/runtimegame.js.map +1 -1
  128. package/dist/Runtime/runtimeobject.js +1 -1
  129. package/dist/Runtime/runtimeobject.js.map +2 -2
  130. package/dist/Runtime/spriteruntimeobject.js +1 -1
  131. package/dist/Runtime/spriteruntimeobject.js.map +2 -2
  132. package/dist/Runtime/types/project-data.d.ts +5 -0
  133. package/dist/lib/libGD.cjs +1 -1
  134. package/dist/lib/libGD.d.cts +5 -0
  135. package/dist/lib/libGD.wasm +0 -0
  136. package/dist/loaders.cjs +3 -1
  137. package/dist/loaders.d.cts +2 -0
  138. package/gd.d.ts +74 -30
  139. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"TileMapModel.d.ts","sourceRoot":"","sources":["../../src/model/TileMapModel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,OAAO,EACP,KAAK,EACL,yBAAyB,EACzB,8BAA8B,EAC/B,MAAM,eAAe,CAAC;AAGvB;;;;;;;GAOG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,uBAAuB,CAAC,CAAS;IACzC,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,OAAO,CAA+B;IAC9C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;IACpC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAU;IACrC;;OAEG;IACH,OAAO,CAAC,IAAI,CAAU;IACtB;;OAEG;IACH,OAAO,CAAC,IAAI,CAAU;IACtB;;;OAGG;IAEH;;;;;;OAMG;gBAED,SAAS,EAAE,OAAO,EAClB,UAAU,EAAE,OAAO,EACnB,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,OAAO,EAGb,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,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AE,MAAM,GAAG,eAAe,EAAE,GAAG,SAAS;IAOvD;;;;OAIG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAOnC;;;;;OAKG;IACH,kBAAkB,IAAI,OAAO;IAI7B;;OAEG;IACH,cAAc,IAAI,OAAO;IAIzB;;OAEG;IACH,eAAe,IAAI,OAAO,EAAE;IAI5B;;OAEG;IACH,eAAe,IAAI,OAAO;IAI1B;;;OAGG;IACH,eAAe,CAAC,WAAW,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI;CAIjE"}
@@ -60,6 +60,7 @@ export declare namespace PixiTileMapHelper {
60
60
  pixiGraphics: PIXI.Graphics,
61
61
  tileMap: EditableTileMap,
62
62
  typeFilter: string,
63
+ layerIndex: integer | null,
63
64
  outlineSize: integer,
64
65
  outlineColor: integer,
65
66
  outlineOpacity: float,
@@ -1 +1 @@
1
- {"version":3,"file":"TileMapPixiHelper.d.ts","sourceRoot":"","sources":["../../src/render/TileMapPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAEL,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,yBAAiB,iBAAiB,CAAC;IACjC;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,EACpD,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GACnE,gBAAgB,GAAG,IAAI,CAuBzB;IAED;;;;;;;;OAQG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,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GACnE,gBAAgB,GAAG,IAAI,CAuBzB;IAED;;;;;;;;OAQG;IACH,SAAgB,uBAAuB,CACrC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC7C,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,gBAAgB,CAqBlB;IAED;;;;;;;;;;;;OAYG;IACH,SAAgB,iBAAiB,CAC/B,kBAAkB,EAAE,GAAG,EACvB,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,EACxC,UAAU,EAAE,MAAM,GACjB,IAAI,CA0GN;IAED;;OAEG;IACH,SAAgB,uBAAuB,CACrC,YAAY,EAAE,IAAI,CAAC,QAAQ,EAC3B,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,OAAO,GAAG,IAAI,EAC1B,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,OAAO,EACrB,cAAc,EAAE,KAAK,EACrB,SAAS,EAAE,OAAO,EAClB,WAAW,EAAE,KAAK,GACjB,IAAI,CA6BN;CA8DF"}
@@ -1,2 +1,2 @@
1
- var gdjs;(function(s){const a=class extends s.RuntimeObject{constructor(e,t){super(e,t);this._displayMode="all";this._layerIndex=0;this._initialTileMapAsJsObject=null;this._isTileMapDirty=!1;this._sceneToTileMapTransformation=new s.AffineTransformation;this._tileMapToSceneTransformation=new s.AffineTransformation;this._collisionTileMap=null;this._hitBoxTag="collision";this._transformationIsUpToDate=!1;this._opacity=t.content.opacity,this._atlasImage=t.content.atlasImage,this._rowCount=t.content.rowCount,this._columnCount=t.content.columnCount,this._tileSize=t.content.tileSize,this._initialTilesWithHitBox=t.content.tilesWithHitBox.split(",").filter(i=>!!i).map(i=>parseInt(i,10)),this._tileMapManager=s.TileMap.TileMapRuntimeManager.getManager(e),this._renderer=new s.TileMapRuntimeObjectRenderer(this,e),this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}updatePreRender(e){if(this._isTileMapDirty){if(this._tileMapManager.getOrLoadSimpleTileMapTextureCache(t=>this.getInstanceContainer().getGame().getImageManager().getPIXITexture(t),this._atlasImage,this._tileSize,this._columnCount,this._rowCount,t=>{!t||this._renderer.refreshPixiTileMap(t)}),this._collisionTileMap){const t=this._renderer.getTileMap();t&&this._collisionTileMap.updateFromTileMap(t)}this._isTileMapDirty=!1}}updateFromObjectData(e,t){return e.content.opacity!==t.content.opacity&&this.setOpacity(t.content.opacity),e.content.atlasImage===t.content.atlasImage}getNetworkSyncData(){return{...super.getNetworkSyncData(),op:this._opacity,ai:this._atlasImage,wid:this.getWidth(),hei:this.getHeight()}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),e.op!==void 0&&e.op!==this._opacity&&this.setOpacity(e.op),e.wid!==void 0&&e.wid!==this.getWidth()&&this.setWidth(e.wid),e.hei!==void 0&&e.hei!==this.getHeight()&&this.setHeight(e.hei),e.ai!==void 0}extraInitializationFromInitialInstance(e){for(const t of e.stringProperties)t.name==="tilemap"&&(this._initialTileMapAsJsObject=JSON.parse(t.value));this._loadInitialTileMap(t=>{e.customSize&&(this.setWidth(e.width),this.setHeight(e.height)),this._renderer.updatePosition(),this._collisionTileMap?this._collisionTileMap.updateFromTileMap(t):this._collisionTileMap=new s.TileMap.TransformedCollisionTileMap(t,this._hitBoxTag),this.updateTransformation()})}_loadInitialTileMap(e){!this._initialTileMapAsJsObject||this._tileMapManager.getOrLoadSimpleTileMap(this._initialTileMapAsJsObject,this.name,this._tileSize,this._columnCount,this._rowCount,t=>{this._initialTilesWithHitBox.forEach(i=>{const o=t.getTileDefinition(i);if(!o){console.warn(`Could not set hit box for tile with id ${i}. Continuing.`);return}o.addHitBox(this._hitBoxTag,[[0,0],[0,t.getTileHeight()],[t.getTileWidth(),t.getTileHeight()],[t.getTileWidth(),0]],!0)}),this._tileMapManager.getOrLoadSimpleTileMapTextureCache(i=>this.getInstanceContainer().getGame().getImageManager().getPIXITexture(i),this._atlasImage,this._tileSize,this._columnCount,this._rowCount,i=>{!i||(this._renderer.updatePixiTileMap(t,i),e(t))})})}onDestroyed(){super.onDestroyed(),this._renderer.destroy()}setWidth(e){this.getWidth()!==e&&(this._transformationIsUpToDate=!1,this._renderer.setWidth(e),this.invalidateHitboxes())}setHeight(e){this.getHeight()!==e&&(this._transformationIsUpToDate=!1,this._renderer.setHeight(e),this.invalidateHitboxes())}setSize(e,t){this.setWidth(e),this.setHeight(t),this._transformationIsUpToDate=!1}getScale(){const e=this.getScaleX(),t=this.getScaleY();return e===t?e:Math.sqrt(e*t)}setScale(e){this.setScaleX(e),this.setScaleY(e),this._transformationIsUpToDate=!1}setScaleX(e){e<0&&(e=0),this.getScaleX()!==e&&(this._renderer.setScaleX(e),this.invalidateHitboxes(),this._transformationIsUpToDate=!1)}setScaleY(e){e<0&&(e=0),this.getScaleY()!==e&&(this._renderer.setScaleY(e),this.invalidateHitboxes(),this._transformationIsUpToDate=!1)}setX(e){super.setX(e),this._renderer.updatePosition(),this._transformationIsUpToDate=!1}setY(e){super.setY(e),this._renderer.updatePosition(),this._transformationIsUpToDate=!1}setAngle(e){super.setAngle(e),this._renderer.updateAngle(),this._transformationIsUpToDate=!1}setOpacity(e){this._opacity=e,this._renderer.updateOpacity(),this._isTileMapDirty=!0}getOpacity(){return this._opacity}getWidth(){return this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}getScaleX(){return this._renderer.getScaleX()}getScaleY(){return this._renderer.getScaleY()}getHitBoxes(){return this.hitBoxesDirty&&(this.updateHitBoxes(),this.updateAABB(),this.hitBoxesDirty=!1),this.hitBoxes}updateHitBoxes(){this.updateTransformation(),!!this._collisionTileMap&&(this.hitBoxes=Array.from(this._collisionTileMap.getAllHitboxes(this._hitBoxTag)),this.hitBoxesDirty=!1,this.updateAABB())}updateAABB(){if(this.getAngle()===0)this.aabb.min[0]=this.x,this.aabb.min[1]=this.y,this.aabb.max[0]=this.aabb.min[0]+this.getWidth(),this.aabb.max[1]=this.aabb.min[1]+this.getHeight();else{if(!this._collisionTileMap)return;const e=this._collisionTileMap.getTransformation(),t=0,i=this._collisionTileMap.getWidth(),o=0,r=this._collisionTileMap.getHeight(),n=this.aabb.min;n[0]=t,n[1]=o,e.transform(n,n);const l=n[0],h=n[1];n[0]=i,n[1]=o,e.transform(n,n);const d=n[0],p=n[1];n[0]=i,n[1]=r,e.transform(n,n);const g=n[0],f=n[1];n[0]=t,n[1]=r,e.transform(n,n);const u=n[0],c=n[1];this.aabb.min[0]=Math.min(l,d,g,u),this.aabb.max[0]=Math.max(l,d,g,u),this.aabb.min[1]=Math.min(h,p,f,c),this.aabb.max[1]=Math.max(h,p,f,c)}}getHitBoxesAround(e,t,i,o){return this.updateTransformation(),this._collisionTileMap?this._collisionTileMap.getHitboxesAround(this._hitBoxTag,e,t,i,o):[]}updateTransformation(){if(this._transformationIsUpToDate)return;const e=Math.abs(this._renderer.getScaleX()),t=Math.abs(this._renderer.getScaleY());this._tileMapToSceneTransformation.setToIdentity(),this._tileMapToSceneTransformation.translate(this.getX(),this.getY());const i=this.getAngle()*Math.PI/180;if(this._tileMapToSceneTransformation.rotateAround(i,this.getCenterX(),this.getCenterY()),this._tileMapToSceneTransformation.scale(e,t),this._collisionTileMap){const o=this._collisionTileMap.getTransformation();o.copyFrom(this._tileMapToSceneTransformation),this._collisionTileMap.setTransformation(o)}this._sceneToTileMapTransformation.copyFrom(this._tileMapToSceneTransformation),this._sceneToTileMapTransformation.invert(),this._transformationIsUpToDate=!0}getSceneXCoordinateOfTileCenter(e,t){const i=a.workingPoint;return this._tileMapToSceneTransformation.transform([(e+.5)*this._tileSize,(t+.5)*this._tileSize],i),i[0]}getSceneYCoordinateOfTileCenter(e,t){const i=a.workingPoint;return this._tileMapToSceneTransformation.transform([(e+.5)*this._tileSize,(t+.5)*this._tileSize],i),i[1]}getGridCoordinatesFromSceneCoordinates(e,t){this.updateTransformation();const i=a.workingPoint;this._sceneToTileMapTransformation.transform([e,t],i);const o=Math.floor(i[0]/this._tileSize),r=Math.floor(i[1]/this._tileSize);return[o,r]}getColumnIndexAtPosition(e,t){return this.getGridCoordinatesFromSceneCoordinates(e,t)[0]}getRowIndexAtPosition(e,t){return this.getGridCoordinatesFromSceneCoordinates(e,t)[1]}getTileAtPosition(e,t){const[i,o]=this.getGridCoordinatesFromSceneCoordinates(e,t);return this.getTileAtGridCoordinates(i,o)}getTileAtGridCoordinates(e,t){return this._renderer.getTileId(e,t,0)}setTileAtPosition(e,t,i){const[o,r]=this.getGridCoordinatesFromSceneCoordinates(t,i);this.setTileAtGridCoordinates(e,o,r)}setTileAtGridCoordinates(e,t,i){const o=this._renderer._tileMap;if(!o)return;const r=o.getTileLayer(this._layerIndex);if(!r)return;const n=r.getTileId(t,i);if(e!==n){if(r.setTile(t,i,e),this._collisionTileMap){const l=n!==void 0&&o.getTileDefinition(n),h=o.getTileDefinition(e),d=!!l&&l.hasFullHitBox(this._hitBoxTag),p=!!h&&h.hasFullHitBox(this._hitBoxTag);d!==p&&this._collisionTileMap.invalidateTile(this._layerIndex,t,i)}this._isTileMapDirty=!0,this.invalidateHitboxes()}}flipTileOnYAtPosition(e,t,i){const[o,r]=this.getGridCoordinatesFromSceneCoordinates(e,t);this.flipTileOnYAtGridCoordinates(o,r,i)}flipTileOnXAtPosition(e,t,i){const[o,r]=this.getGridCoordinatesFromSceneCoordinates(e,t);this.flipTileOnXAtGridCoordinates(o,r,i)}flipTileOnYAtGridCoordinates(e,t,i){this._renderer.flipTileOnY(e,t,0,i),this._isTileMapDirty=!0}flipTileOnXAtGridCoordinates(e,t,i){this._renderer.flipTileOnX(e,t,0,i),this._isTileMapDirty=!0}isTileFlippedOnXAtPosition(e,t){const[i,o]=this.getGridCoordinatesFromSceneCoordinates(e,t);return this._renderer.isTileFlippedOnX(i,o,0)}isTileFlippedOnXAtGridCoordinates(e,t){return this._renderer.isTileFlippedOnX(e,t,0)}isTileFlippedOnYAtPosition(e,t){const[i,o]=this.getGridCoordinatesFromSceneCoordinates(e,t);return this._renderer.isTileFlippedOnY(i,o,0)}isTileFlippedOnYAtGridCoordinates(e,t){return this._renderer.isTileFlippedOnY(e,t,0)}removeTileAtPosition(e,t){const[i,o]=this.getGridCoordinatesFromSceneCoordinates(e,t);this.removeTileAtGridCoordinates(i,o)}removeTileAtGridCoordinates(e,t){const i=this._renderer._tileMap;if(!i)return;const o=i.getTileLayer(this._layerIndex);!o||o.getTileId(e,t)===void 0||(o.removeTile(e,t),this._collisionTileMap&&this._collisionTileMap.invalidateTile(this._layerIndex,e,t),this._isTileMapDirty=!0,this.invalidateHitboxes())}setGridRowCount(e){e<=0||(this._renderer.setGridRowCount(e),this._isTileMapDirty=!0,this.invalidateHitboxes())}setGridColumnCount(e){e<=0||(this._renderer.setGridColumnCount(e),this._isTileMapDirty=!0,this.invalidateHitboxes())}getGridRowCount(){return this._renderer.getGridRowCount()}getGridColumnCount(){return this._renderer.getGridColumnCount()}getTilesetColumnCount(){return this._columnCount}getTilesetRowCount(){return this._rowCount}};let T=a;T.workingPoint=[0,0],s.SimpleTileMapRuntimeObject=T,s.registerObject("TileMap::SimpleTileMap",s.SimpleTileMapRuntimeObject)})(gdjs||(gdjs={}));
1
+ var gdjs;(function(s){const a=class extends s.RuntimeObject{constructor(e,t){super(e,t);this._displayMode="all";this._layerIndex=0;this._initialTileMapAsJsObject=null;this._isTileMapDirty=!1;this._sceneToTileMapTransformation=new s.AffineTransformation;this._tileMapToSceneTransformation=new s.AffineTransformation;this._collisionTileMap=null;this._hitBoxTag="collision";this._transformationIsUpToDate=!1;this._opacity=t.content.opacity,this._atlasImage=t.content.atlasImage,this._rowCount=t.content.rowCount,this._columnCount=t.content.columnCount,this._tileSize=t.content.tileSize,this._initialTilesWithHitBox=t.content.tilesWithHitBox.split(",").filter(i=>!!i).map(i=>parseInt(i,10)),this._tileMapManager=s.TileMap.TileMapRuntimeManager.getManager(e),this._renderer=new s.TileMapRuntimeObjectRenderer(this,e),this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}updatePreRender(e){if(this._isTileMapDirty){let t=!0;if(this._tileMapManager.getOrLoadSimpleTileMapTextureCache(i=>this.getInstanceContainer().getGame().getImageManager().getPIXITexture(i),this._atlasImage,this._tileSize,this._columnCount,this._rowCount,i=>{!i||this._renderer.refreshPixiTileMap(i)},i=>{t=!1,console.error(`Could not load texture cache for atlas ${this._atlasImage} during prerender. The tilemap might be badly configured or an issues happened with the loaded atlas image:`,i)}),!t)return;if(this._collisionTileMap){const i=this._renderer.getTileMap();i&&this._collisionTileMap.updateFromTileMap(i)}this._isTileMapDirty=!1}}updateFromObjectData(e,t){return e.content.opacity!==t.content.opacity&&this.setOpacity(t.content.opacity),e.content.atlasImage===t.content.atlasImage}getNetworkSyncData(){return{...super.getNetworkSyncData(),op:this._opacity,ai:this._atlasImage,wid:this.getWidth(),hei:this.getHeight()}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),e.op!==void 0&&e.op!==this._opacity&&this.setOpacity(e.op),e.wid!==void 0&&e.wid!==this.getWidth()&&this.setWidth(e.wid),e.hei!==void 0&&e.hei!==this.getHeight()&&this.setHeight(e.hei),e.ai!==void 0}extraInitializationFromInitialInstance(e){for(const t of e.stringProperties)t.name==="tilemap"&&(this._initialTileMapAsJsObject=JSON.parse(t.value));this._loadInitialTileMap(t=>{e.customSize&&(this.setWidth(e.width),this.setHeight(e.height)),e.opacity!==void 0&&this.setOpacity(e.opacity),this._renderer.updatePosition(),this._collisionTileMap?this._collisionTileMap.updateFromTileMap(t):this._collisionTileMap=new s.TileMap.TransformedCollisionTileMap(t,this._hitBoxTag),this.updateTransformation()})}_loadInitialTileMap(e){if(!!this._initialTileMapAsJsObject){if(this._columnCount<=0||this._rowCount<=0){console.error(`Tilemap object ${this.name} is not configured properly.`);return}this._tileMapManager.getOrLoadSimpleTileMap(this._initialTileMapAsJsObject,this.name,this._tileSize,this._columnCount,this._rowCount,t=>{this._initialTilesWithHitBox.forEach(i=>{const o=t.getTileDefinition(i);if(!o){console.warn(`Could not set hit box for tile with id ${i}. Continuing.`);return}o.addHitBox(this._hitBoxTag,[[0,0],[0,t.getTileHeight()],[t.getTileWidth(),t.getTileHeight()],[t.getTileWidth(),0]],!0)}),this._tileMapManager.getOrLoadSimpleTileMapTextureCache(i=>this.getInstanceContainer().getGame().getImageManager().getPIXITexture(i),this._atlasImage,this._tileSize,this._columnCount,this._rowCount,i=>{!i||(this._renderer.updatePixiTileMap(t,i),e(t))},i=>{console.error(`Could not load texture cache for atlas ${this._atlasImage} during initial loading. The tilemap might be badly configured or an issues happened with the loaded atlas image:`,i)})})}}onDestroyed(){super.onDestroyed(),this._renderer.destroy()}setWidth(e){this.getWidth()!==e&&(this._transformationIsUpToDate=!1,this._renderer.setWidth(e),this.invalidateHitboxes())}setHeight(e){this.getHeight()!==e&&(this._transformationIsUpToDate=!1,this._renderer.setHeight(e),this.invalidateHitboxes())}setSize(e,t){this.setWidth(e),this.setHeight(t),this._transformationIsUpToDate=!1}getScale(){const e=this.getScaleX(),t=this.getScaleY();return e===t?e:Math.sqrt(e*t)}setScale(e){this.setScaleX(e),this.setScaleY(e),this._transformationIsUpToDate=!1}setScaleX(e){e<0&&(e=0),this.getScaleX()!==e&&(this._renderer.setScaleX(e),this.invalidateHitboxes(),this._transformationIsUpToDate=!1)}setScaleY(e){e<0&&(e=0),this.getScaleY()!==e&&(this._renderer.setScaleY(e),this.invalidateHitboxes(),this._transformationIsUpToDate=!1)}setX(e){super.setX(e),this._renderer.updatePosition(),this._transformationIsUpToDate=!1}setY(e){super.setY(e),this._renderer.updatePosition(),this._transformationIsUpToDate=!1}setAngle(e){super.setAngle(e),this._renderer.updateAngle(),this._transformationIsUpToDate=!1}setOpacity(e){this._opacity=e,this._renderer.updateOpacity(),this._isTileMapDirty=!0}getOpacity(){return this._opacity}getWidth(){return this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}getScaleX(){return this._renderer.getScaleX()}getScaleY(){return this._renderer.getScaleY()}getHitBoxes(){return this.hitBoxesDirty&&(this.updateHitBoxes(),this.updateAABB(),this.hitBoxesDirty=!1),this.hitBoxes}updateHitBoxes(){this.updateTransformation(),!!this._collisionTileMap&&(this.hitBoxes=Array.from(this._collisionTileMap.getAllHitboxes(this._hitBoxTag)),this.hitBoxesDirty=!1,this.updateAABB())}updateAABB(){if(this.getAngle()===0)this.aabb.min[0]=this.x,this.aabb.min[1]=this.y,this.aabb.max[0]=this.aabb.min[0]+this.getWidth(),this.aabb.max[1]=this.aabb.min[1]+this.getHeight();else{if(!this._collisionTileMap)return;const e=this._collisionTileMap.getTransformation(),t=0,i=this._collisionTileMap.getWidth(),o=0,r=this._collisionTileMap.getHeight(),n=this.aabb.min;n[0]=t,n[1]=o,e.transform(n,n);const l=n[0],h=n[1];n[0]=i,n[1]=o,e.transform(n,n);const d=n[0],p=n[1];n[0]=i,n[1]=r,e.transform(n,n);const g=n[0],f=n[1];n[0]=t,n[1]=r,e.transform(n,n);const u=n[0],c=n[1];this.aabb.min[0]=Math.min(l,d,g,u),this.aabb.max[0]=Math.max(l,d,g,u),this.aabb.min[1]=Math.min(h,p,f,c),this.aabb.max[1]=Math.max(h,p,f,c)}}getHitBoxesAround(e,t,i,o){return this.updateTransformation(),this._collisionTileMap?this._collisionTileMap.getHitboxesAround(this._hitBoxTag,e,t,i,o):[]}updateTransformation(){if(this._transformationIsUpToDate)return;const e=Math.abs(this._renderer.getScaleX()),t=Math.abs(this._renderer.getScaleY());this._tileMapToSceneTransformation.setToIdentity(),this._tileMapToSceneTransformation.translate(this.getX(),this.getY());const i=this.getAngle()*Math.PI/180;if(this._tileMapToSceneTransformation.rotateAround(i,this.getCenterX(),this.getCenterY()),this._tileMapToSceneTransformation.scale(e,t),this._collisionTileMap){const o=this._collisionTileMap.getTransformation();o.copyFrom(this._tileMapToSceneTransformation),this._collisionTileMap.setTransformation(o)}this._sceneToTileMapTransformation.copyFrom(this._tileMapToSceneTransformation),this._sceneToTileMapTransformation.invert(),this._transformationIsUpToDate=!0}getSceneXCoordinateOfTileCenter(e,t){const i=a.workingPoint;return this._tileMapToSceneTransformation.transform([(e+.5)*this._tileSize,(t+.5)*this._tileSize],i),i[0]}getSceneYCoordinateOfTileCenter(e,t){const i=a.workingPoint;return this._tileMapToSceneTransformation.transform([(e+.5)*this._tileSize,(t+.5)*this._tileSize],i),i[1]}getGridCoordinatesFromSceneCoordinates(e,t){this.updateTransformation();const i=a.workingPoint;this._sceneToTileMapTransformation.transform([e,t],i);const o=Math.floor(i[0]/this._tileSize),r=Math.floor(i[1]/this._tileSize);return[o,r]}getColumnIndexAtPosition(e,t){return this.getGridCoordinatesFromSceneCoordinates(e,t)[0]}getRowIndexAtPosition(e,t){return this.getGridCoordinatesFromSceneCoordinates(e,t)[1]}getTileAtPosition(e,t){const[i,o]=this.getGridCoordinatesFromSceneCoordinates(e,t);return this.getTileAtGridCoordinates(i,o)}getTileAtGridCoordinates(e,t){return this._renderer.getTileId(e,t,0)}setTileAtPosition(e,t,i){const[o,r]=this.getGridCoordinatesFromSceneCoordinates(t,i);this.setTileAtGridCoordinates(e,o,r)}setTileAtGridCoordinates(e,t,i){const o=this._renderer._tileMap;if(!o)return;const r=o.getTileLayer(this._layerIndex);if(!r)return;const n=r.getTileId(t,i);if(e!==n){if(r.setTile(t,i,e),this._collisionTileMap){const l=n!==void 0&&o.getTileDefinition(n),h=o.getTileDefinition(e),d=!!l&&l.hasFullHitBox(this._hitBoxTag),p=!!h&&h.hasFullHitBox(this._hitBoxTag);d!==p&&this._collisionTileMap.invalidateTile(this._layerIndex,t,i)}this._isTileMapDirty=!0,this.invalidateHitboxes()}}flipTileOnYAtPosition(e,t,i){const[o,r]=this.getGridCoordinatesFromSceneCoordinates(e,t);this.flipTileOnYAtGridCoordinates(o,r,i)}flipTileOnXAtPosition(e,t,i){const[o,r]=this.getGridCoordinatesFromSceneCoordinates(e,t);this.flipTileOnXAtGridCoordinates(o,r,i)}flipTileOnYAtGridCoordinates(e,t,i){this._renderer.flipTileOnY(e,t,0,i),this._isTileMapDirty=!0}flipTileOnXAtGridCoordinates(e,t,i){this._renderer.flipTileOnX(e,t,0,i),this._isTileMapDirty=!0}isTileFlippedOnXAtPosition(e,t){const[i,o]=this.getGridCoordinatesFromSceneCoordinates(e,t);return this._renderer.isTileFlippedOnX(i,o,0)}isTileFlippedOnXAtGridCoordinates(e,t){return this._renderer.isTileFlippedOnX(e,t,0)}isTileFlippedOnYAtPosition(e,t){const[i,o]=this.getGridCoordinatesFromSceneCoordinates(e,t);return this._renderer.isTileFlippedOnY(i,o,0)}isTileFlippedOnYAtGridCoordinates(e,t){return this._renderer.isTileFlippedOnY(e,t,0)}removeTileAtPosition(e,t){const[i,o]=this.getGridCoordinatesFromSceneCoordinates(e,t);this.removeTileAtGridCoordinates(i,o)}removeTileAtGridCoordinates(e,t){const i=this._renderer._tileMap;if(!i)return;const o=i.getTileLayer(this._layerIndex);!o||o.getTileId(e,t)===void 0||(o.removeTile(e,t),this._collisionTileMap&&this._collisionTileMap.invalidateTile(this._layerIndex,e,t),this._isTileMapDirty=!0,this.invalidateHitboxes())}setGridRowCount(e){e<=0||(this._renderer.setGridRowCount(e),this._isTileMapDirty=!0,this.invalidateHitboxes())}setGridColumnCount(e){e<=0||(this._renderer.setGridColumnCount(e),this._isTileMapDirty=!0,this.invalidateHitboxes())}getGridRowCount(){return this._renderer.getGridRowCount()}getGridColumnCount(){return this._renderer.getGridColumnCount()}getTilesetColumnCount(){return this._columnCount}getTilesetRowCount(){return this._rowCount}};let T=a;T.workingPoint=[0,0],s.SimpleTileMapRuntimeObject=T,s.registerObject("TileMap::SimpleTileMap",s.SimpleTileMapRuntimeObject)})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=simpletilemapruntimeobject.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/TileMap/simpletilemapruntimeobject.ts"],
4
- "sourcesContent": ["/// <reference path=\"helper/TileMapHelper.d.ts\" />\nnamespace gdjs {\n export type SimpleTileMapObjectDataType = {\n content: {\n opacity: number;\n atlasImage: string;\n rowCount: number;\n columnCount: number;\n tileSize: number;\n tilesWithHitBox: string;\n };\n };\n\n export type SimpleTileMapObjectData = ObjectData &\n SimpleTileMapObjectDataType;\n\n export type SimpleTileMapNetworkSyncDataType = {\n op: number;\n ai: string;\n wid: number;\n hei: number;\n // TODO: Support tilemap synchronization. Find an efficient way to send tiles changes.\n };\n\n export type SimpleTileMapNetworkSyncData = ObjectNetworkSyncData &\n SimpleTileMapNetworkSyncDataType;\n\n /**\n * Displays a SimpleTileMap object.\n */\n export class SimpleTileMapRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.Scalable, gdjs.OpacityHandler {\n /**\n * A reusable Point to avoid allocations.\n */\n private static readonly workingPoint: FloatPoint = [0, 0];\n\n _opacity: float;\n _atlasImage: string;\n _tileMapManager: gdjs.TileMap.TileMapRuntimeManager;\n _renderer: gdjs.TileMapRuntimeObjectPixiRenderer;\n readonly _rowCount: number;\n readonly _columnCount: number;\n readonly _tileSize: number;\n _displayMode = 'all';\n _layerIndex = 0;\n _initialTileMapAsJsObject: TileMapHelper.EditableTileMapAsJsObject | null = null;\n readonly _initialTilesWithHitBox: number[];\n _isTileMapDirty: boolean = false;\n _sceneToTileMapTransformation: gdjs.AffineTransformation = new gdjs.AffineTransformation();\n _tileMapToSceneTransformation: gdjs.AffineTransformation = new gdjs.AffineTransformation();\n _collisionTileMap: gdjs.TileMap.TransformedCollisionTileMap | null = null;\n _hitBoxTag: string = 'collision';\n private _transformationIsUpToDate: boolean = false;\n\n // TODO: Add a debug mode like for TileMapCollisionMaskRuntimeObject to draw?\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: SimpleTileMapObjectDataType\n ) {\n super(instanceContainer, objectData);\n this._opacity = objectData.content.opacity;\n this._atlasImage = objectData.content.atlasImage;\n this._rowCount = objectData.content.rowCount;\n this._columnCount = objectData.content.columnCount;\n this._tileSize = objectData.content.tileSize;\n this._initialTilesWithHitBox = (objectData.content\n .tilesWithHitBox as string)\n .split(',')\n .filter((id) => !!id)\n .map((idAsString) => parseInt(idAsString, 10));\n this._tileMapManager = gdjs.TileMap.TileMapRuntimeManager.getManager(\n instanceContainer\n );\n this._renderer = new gdjs.TileMapRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n updatePreRender(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n if (this._isTileMapDirty) {\n this._tileMapManager.getOrLoadSimpleTileMapTextureCache(\n (textureName) => {\n return (this.getInstanceContainer()\n .getGame()\n .getImageManager()\n .getPIXITexture(textureName) as unknown) as PIXI.BaseTexture<\n PIXI.Resource\n >;\n },\n this._atlasImage,\n this._tileSize,\n this._columnCount,\n this._rowCount,\n (textureCache: TileMapHelper.TileTextureCache | null) => {\n if (!textureCache) {\n // getOrLoadTextureCache already log warns and errors.\n return;\n }\n this._renderer.refreshPixiTileMap(textureCache);\n }\n );\n if (this._collisionTileMap) {\n const tileMap = this._renderer.getTileMap();\n if (tileMap) this._collisionTileMap.updateFromTileMap(tileMap);\n }\n this._isTileMapDirty = false;\n }\n }\n\n updateFromObjectData(\n oldObjectData: SimpleTileMapObjectData,\n newObjectData: SimpleTileMapObjectData\n ): boolean {\n if (oldObjectData.content.opacity !== newObjectData.content.opacity) {\n this.setOpacity(newObjectData.content.opacity);\n }\n if (\n oldObjectData.content.atlasImage !== newObjectData.content.atlasImage\n ) {\n // TODO: support changing the atlas texture\n return false;\n }\n // Map content is updated at hot-reload by extraInitializationFromInitialInstance.\n return true;\n }\n\n getNetworkSyncData(): SimpleTileMapNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n op: this._opacity,\n ai: this._atlasImage,\n wid: this.getWidth(),\n hei: this.getHeight(),\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: SimpleTileMapNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n if (\n networkSyncData.op !== undefined &&\n networkSyncData.op !== this._opacity\n ) {\n this.setOpacity(networkSyncData.op);\n }\n if (\n networkSyncData.wid !== undefined &&\n networkSyncData.wid !== this.getWidth()\n ) {\n this.setWidth(networkSyncData.wid);\n }\n if (\n networkSyncData.hei !== undefined &&\n networkSyncData.hei !== this.getHeight()\n ) {\n this.setHeight(networkSyncData.hei);\n }\n if (networkSyncData.ai !== undefined) {\n // TODO: support changing the atlas texture\n }\n }\n\n extraInitializationFromInitialInstance(\n initialInstanceData: InstanceData\n ): void {\n // 1. load the tilemap from the instance.\n for (const property of initialInstanceData.stringProperties) {\n if (property.name === 'tilemap') {\n this._initialTileMapAsJsObject = JSON.parse(property.value);\n }\n }\n\n // 2. Update the renderer so that it updates the tilemap object\n // (used for width and position calculations).\n this._loadInitialTileMap((tileMap: TileMapHelper.EditableTileMap) => {\n // 3. Set custom dimensions if applicable.\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n\n // 4. Update position (calculations based on renderer's dimensions).\n this._renderer.updatePosition();\n\n if (this._collisionTileMap) {\n // If collision tile map is already defined, there's a good chance it means\n // extraInitializationFromInitialInstance is called when hot reloading the\n // scene so the collision is tile map is updated instead of being re-created.\n this._collisionTileMap.updateFromTileMap(tileMap);\n } else {\n this._collisionTileMap = new gdjs.TileMap.TransformedCollisionTileMap(\n tileMap,\n this._hitBoxTag\n );\n }\n\n this.updateTransformation();\n });\n }\n\n private _loadInitialTileMap(\n tileMapLoadingCallback: (tileMap: TileMapHelper.EditableTileMap) => void\n ): void {\n if (!this._initialTileMapAsJsObject) return;\n\n this._tileMapManager.getOrLoadSimpleTileMap(\n this._initialTileMapAsJsObject,\n this.name,\n this._tileSize,\n this._columnCount,\n this._rowCount,\n (tileMap: TileMapHelper.EditableTileMap) => {\n this._initialTilesWithHitBox.forEach((tileId) => {\n const tileDefinition = tileMap.getTileDefinition(tileId);\n if (!tileDefinition) {\n console.warn(\n `Could not set hit box for tile with id ${tileId}. Continuing.`\n );\n return;\n }\n tileDefinition.addHitBox(\n this._hitBoxTag,\n [\n [0, 0],\n [0, tileMap.getTileHeight()],\n [tileMap.getTileWidth(), tileMap.getTileHeight()],\n [tileMap.getTileWidth(), 0],\n ],\n true\n );\n });\n\n this._tileMapManager.getOrLoadSimpleTileMapTextureCache(\n (textureName) => {\n return (this.getInstanceContainer()\n .getGame()\n .getImageManager()\n .getPIXITexture(textureName) as unknown) as PIXI.BaseTexture<\n PIXI.Resource\n >;\n },\n this._atlasImage,\n this._tileSize,\n this._columnCount,\n this._rowCount,\n (textureCache: TileMapHelper.TileTextureCache | null) => {\n if (!textureCache) {\n // getOrLoadTextureCache already log warns and errors.\n return;\n }\n this._renderer.updatePixiTileMap(tileMap, textureCache);\n tileMapLoadingCallback(tileMap);\n }\n );\n }\n );\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n setWidth(width: float): void {\n if (this.getWidth() === width) return;\n\n this._transformationIsUpToDate = false;\n this._renderer.setWidth(width);\n this.invalidateHitboxes();\n }\n\n setHeight(height: float): void {\n if (this.getHeight() === height) return;\n\n this._transformationIsUpToDate = false;\n this._renderer.setHeight(height);\n this.invalidateHitboxes();\n }\n\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n this._transformationIsUpToDate = false;\n }\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 = this.getScaleX();\n const scaleY = this.getScaleY();\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Change the scale on X and Y axis of the object.\n *\n * @param scale The new scale (must be greater than 0).\n */\n setScale(scale: float): void {\n this.setScaleX(scale);\n this.setScaleY(scale);\n this._transformationIsUpToDate = false;\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param scaleX The new scale (must be greater than 0).\n */\n setScaleX(scaleX: float): void {\n if (scaleX < 0) {\n scaleX = 0;\n }\n if (this.getScaleX() === scaleX) return;\n\n this._renderer.setScaleX(scaleX);\n this.invalidateHitboxes();\n this._transformationIsUpToDate = false;\n }\n\n /**\n * Change the scale on Y axis of the object (changing its width).\n *\n * @param scaleY The new scale (must be greater than 0).\n */\n setScaleY(scaleY: float): void {\n if (scaleY < 0) {\n scaleY = 0;\n }\n if (this.getScaleY() === scaleY) return;\n\n this._renderer.setScaleY(scaleY);\n this.invalidateHitboxes();\n this._transformationIsUpToDate = false;\n }\n\n setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n this._transformationIsUpToDate = false;\n }\n\n setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n this._transformationIsUpToDate = false;\n }\n\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n this._transformationIsUpToDate = false;\n }\n\n setOpacity(opacity: float): void {\n this._opacity = opacity;\n this._renderer.updateOpacity();\n this._isTileMapDirty = true;\n }\n\n getOpacity(): float {\n return this._opacity;\n }\n\n getWidth(): float {\n return this._renderer.getWidth();\n }\n\n getHeight(): float {\n return this._renderer.getHeight();\n }\n\n getScaleX(): float {\n return this._renderer.getScaleX();\n }\n\n getScaleY(): float {\n return this._renderer.getScaleY();\n }\n\n /**\n * This method is expensive and should not be called.\n * Prefer using {@link getHitBoxesAround} rather than getHitBoxes.\n */\n getHitBoxes(): gdjs.Polygon[] {\n if (this.hitBoxesDirty) {\n this.updateHitBoxes();\n this.updateAABB();\n this.hitBoxesDirty = false;\n }\n return this.hitBoxes;\n }\n\n updateHitBoxes(): void {\n this.updateTransformation();\n if (!this._collisionTileMap) return;\n this.hitBoxes = Array.from(\n this._collisionTileMap.getAllHitboxes(this._hitBoxTag)\n );\n this.hitBoxesDirty = false;\n this.updateAABB();\n }\n\n // This implementation doesn't use updateHitBoxes.\n // It's important for good performances.\n updateAABB(): void {\n if (this.getAngle() === 0) {\n // Fast computation of AABB for non rotated object\n this.aabb.min[0] = this.x;\n this.aabb.min[1] = this.y;\n this.aabb.max[0] = this.aabb.min[0] + this.getWidth();\n this.aabb.max[1] = this.aabb.min[1] + this.getHeight();\n } else {\n if (!this._collisionTileMap) return;\n const affineTransformation = this._collisionTileMap.getTransformation();\n\n const left = 0;\n const right = this._collisionTileMap.getWidth();\n const top = 0;\n const bottom = this._collisionTileMap.getHeight();\n\n const workingPoint = this.aabb.min;\n\n workingPoint[0] = left;\n workingPoint[1] = top;\n affineTransformation.transform(workingPoint, workingPoint);\n const topLeftX = workingPoint[0];\n const topLeftY = workingPoint[1];\n\n workingPoint[0] = right;\n workingPoint[1] = top;\n affineTransformation.transform(workingPoint, workingPoint);\n const topRightX = workingPoint[0];\n const topRightY = workingPoint[1];\n\n workingPoint[0] = right;\n workingPoint[1] = bottom;\n affineTransformation.transform(workingPoint, workingPoint);\n const bottomRightX = workingPoint[0];\n const bottomRightY = workingPoint[1];\n\n workingPoint[0] = left;\n workingPoint[1] = bottom;\n affineTransformation.transform(workingPoint, workingPoint);\n const bottomLeftX = workingPoint[0];\n const bottomLeftY = workingPoint[1];\n\n this.aabb.min[0] = Math.min(\n topLeftX,\n topRightX,\n bottomRightX,\n bottomLeftX\n );\n this.aabb.max[0] = Math.max(\n topLeftX,\n topRightX,\n bottomRightX,\n bottomLeftX\n );\n this.aabb.min[1] = Math.min(\n topLeftY,\n topRightY,\n bottomRightY,\n bottomLeftY\n );\n this.aabb.max[1] = Math.max(\n topLeftY,\n topRightY,\n bottomRightY,\n bottomLeftY\n );\n }\n }\n\n getHitBoxesAround(\n left: float,\n top: float,\n right: float,\n bottom: float\n ): Iterable<gdjs.Polygon> {\n // This implementation doesn't call updateHitBoxes.\n // It's important for good performances because there is no need to\n // update the whole collision mask where only a few hitboxes must be\n // checked.\n this.updateTransformation();\n if (!this._collisionTileMap) return [];\n return this._collisionTileMap.getHitboxesAround(\n this._hitBoxTag,\n left,\n top,\n right,\n bottom\n );\n }\n\n updateTransformation() {\n if (this._transformationIsUpToDate) {\n return;\n }\n const absScaleX = Math.abs(this._renderer.getScaleX());\n const absScaleY = Math.abs(this._renderer.getScaleY());\n\n this._tileMapToSceneTransformation.setToIdentity();\n\n // Translation\n this._tileMapToSceneTransformation.translate(this.getX(), this.getY());\n\n // Rotation\n const angleInRadians = (this.getAngle() * Math.PI) / 180;\n this._tileMapToSceneTransformation.rotateAround(\n angleInRadians,\n this.getCenterX(),\n this.getCenterY()\n );\n\n // Scale\n this._tileMapToSceneTransformation.scale(absScaleX, absScaleY);\n if (this._collisionTileMap) {\n const collisionTileMapTransformation = this._collisionTileMap.getTransformation();\n collisionTileMapTransformation.copyFrom(\n this._tileMapToSceneTransformation\n );\n this._collisionTileMap.setTransformation(\n collisionTileMapTransformation\n );\n }\n this._sceneToTileMapTransformation.copyFrom(\n this._tileMapToSceneTransformation\n );\n this._sceneToTileMapTransformation.invert();\n this._transformationIsUpToDate = true;\n }\n\n getSceneXCoordinateOfTileCenter(\n columnIndex: integer,\n rowIndex: integer\n ): float {\n const sceneCoordinates: FloatPoint =\n SimpleTileMapRuntimeObject.workingPoint;\n this._tileMapToSceneTransformation.transform(\n [\n (columnIndex + 0.5) * this._tileSize,\n (rowIndex + 0.5) * this._tileSize,\n ],\n sceneCoordinates\n );\n return sceneCoordinates[0];\n }\n\n getSceneYCoordinateOfTileCenter(\n columnIndex: integer,\n rowIndex: integer\n ): float {\n const sceneCoordinates: FloatPoint =\n SimpleTileMapRuntimeObject.workingPoint;\n this._tileMapToSceneTransformation.transform(\n [\n (columnIndex + 0.5) * this._tileSize,\n (rowIndex + 0.5) * this._tileSize,\n ],\n sceneCoordinates\n );\n return sceneCoordinates[1];\n }\n\n getGridCoordinatesFromSceneCoordinates(\n x: float,\n y: float\n ): [integer, integer] {\n this.updateTransformation();\n\n const gridCoordinates: FloatPoint =\n SimpleTileMapRuntimeObject.workingPoint;\n this._sceneToTileMapTransformation.transform([x, y], gridCoordinates);\n\n const columnIndex = Math.floor(gridCoordinates[0] / this._tileSize);\n const rowIndex = Math.floor(gridCoordinates[1] / this._tileSize);\n\n return [columnIndex, rowIndex];\n }\n\n getColumnIndexAtPosition(x: float, y: float): integer {\n return this.getGridCoordinatesFromSceneCoordinates(x, y)[0];\n }\n\n getRowIndexAtPosition(x: float, y: float): integer {\n return this.getGridCoordinatesFromSceneCoordinates(x, y)[1];\n }\n\n getTileAtPosition(x: float, y: float): integer {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n return this.getTileAtGridCoordinates(columnIndex, rowIndex);\n }\n\n getTileAtGridCoordinates(columnIndex: integer, rowIndex: integer): integer {\n return this._renderer.getTileId(columnIndex, rowIndex, 0);\n }\n\n setTileAtPosition(tileId: number, x: float, y: float) {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n this.setTileAtGridCoordinates(tileId, columnIndex, rowIndex);\n }\n\n setTileAtGridCoordinates(\n tileId: number,\n columnIndex: integer,\n rowIndex: integer\n ) {\n const tileMap = this._renderer._tileMap;\n if (!tileMap) {\n return;\n }\n const layer = tileMap.getTileLayer(this._layerIndex);\n if (!layer) {\n return;\n }\n const oldTileId = layer.getTileId(columnIndex, rowIndex);\n if (tileId === oldTileId) {\n return;\n }\n layer.setTile(columnIndex, rowIndex, tileId);\n\n if (this._collisionTileMap) {\n const oldTileDefinition =\n oldTileId !== undefined && tileMap.getTileDefinition(oldTileId);\n const newTileDefinition = tileMap.getTileDefinition(tileId);\n const hadFullHitBox =\n !!oldTileDefinition &&\n oldTileDefinition.hasFullHitBox(this._hitBoxTag);\n const haveFullHitBox =\n !!newTileDefinition &&\n newTileDefinition.hasFullHitBox(this._hitBoxTag);\n if (hadFullHitBox !== haveFullHitBox) {\n this._collisionTileMap.invalidateTile(\n this._layerIndex,\n columnIndex,\n rowIndex\n );\n }\n }\n this._isTileMapDirty = true;\n this.invalidateHitboxes();\n }\n\n flipTileOnYAtPosition(x: float, y: float, flip: boolean) {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n this.flipTileOnYAtGridCoordinates(columnIndex, rowIndex, flip);\n }\n\n flipTileOnXAtPosition(x: float, y: float, flip: boolean) {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n this.flipTileOnXAtGridCoordinates(columnIndex, rowIndex, flip);\n }\n\n flipTileOnYAtGridCoordinates(\n columnIndex: integer,\n rowIndex: integer,\n flip: boolean\n ) {\n this._renderer.flipTileOnY(columnIndex, rowIndex, 0, flip);\n this._isTileMapDirty = true;\n // No need to invalidate hit boxes since at the moment, collision mask\n // cannot be configured on each tile.\n }\n\n flipTileOnXAtGridCoordinates(\n columnIndex: integer,\n rowIndex: integer,\n flip: boolean\n ) {\n this._renderer.flipTileOnX(columnIndex, rowIndex, 0, flip);\n this._isTileMapDirty = true;\n // No need to invalidate hit boxes since at the moment, collision mask\n // cannot be configured on each tile.\n }\n\n isTileFlippedOnXAtPosition(x: float, y: float) {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n\n return this._renderer.isTileFlippedOnX(columnIndex, rowIndex, 0);\n }\n\n isTileFlippedOnXAtGridCoordinates(columnIndex: integer, rowIndex: integer) {\n return this._renderer.isTileFlippedOnX(columnIndex, rowIndex, 0);\n }\n\n isTileFlippedOnYAtPosition(x: float, y: float) {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n\n return this._renderer.isTileFlippedOnY(columnIndex, rowIndex, 0);\n }\n\n isTileFlippedOnYAtGridCoordinates(columnIndex: integer, rowIndex: integer) {\n return this._renderer.isTileFlippedOnY(columnIndex, rowIndex, 0);\n }\n\n removeTileAtPosition(x: float, y: float) {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n this.removeTileAtGridCoordinates(columnIndex, rowIndex);\n }\n\n removeTileAtGridCoordinates(columnIndex: integer, rowIndex: integer) {\n const tileMap = this._renderer._tileMap;\n if (!tileMap) {\n return;\n }\n const layer = tileMap.getTileLayer(this._layerIndex);\n if (!layer) {\n return;\n }\n const oldTileId = layer.getTileId(columnIndex, rowIndex);\n if (oldTileId === undefined) {\n return;\n }\n layer.removeTile(columnIndex, rowIndex);\n if (this._collisionTileMap) {\n this._collisionTileMap.invalidateTile(\n this._layerIndex,\n columnIndex,\n rowIndex\n );\n }\n this._isTileMapDirty = true;\n this.invalidateHitboxes();\n }\n\n setGridRowCount(targetRowCount: integer) {\n if (targetRowCount <= 0) return;\n this._renderer.setGridRowCount(targetRowCount);\n this._isTileMapDirty = true;\n this.invalidateHitboxes();\n }\n\n setGridColumnCount(targetColumnCount: integer) {\n if (targetColumnCount <= 0) return;\n this._renderer.setGridColumnCount(targetColumnCount);\n this._isTileMapDirty = true;\n this.invalidateHitboxes();\n }\n\n getGridRowCount(): integer {\n return this._renderer.getGridRowCount();\n }\n\n getGridColumnCount(): integer {\n return this._renderer.getGridColumnCount();\n }\n\n getTilesetColumnCount(): integer {\n return this._columnCount;\n }\n\n getTilesetRowCount(): integer {\n return this._rowCount;\n }\n }\n gdjs.registerObject(\n 'TileMap::SimpleTileMap',\n gdjs.SimpleTileMapRuntimeObject\n );\n}\n"],
5
- "mappings": "AACA,GAAU,MAAV,UAAU,EAAV,CA6BS,qBACG,GAAK,aACiD,CA0B9D,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAjB3B,kBAAe,MACf,iBAAc,EACd,+BAA4E,KAE5E,qBAA2B,GAC3B,mCAA2D,GAAI,GAAK,qBACpE,mCAA2D,GAAI,GAAK,qBACpE,uBAA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ileMapHelper.d.ts\" />\nnamespace gdjs {\n export type SimpleTileMapObjectDataType = {\n content: {\n opacity: number;\n atlasImage: string;\n rowCount: number;\n columnCount: number;\n tileSize: number;\n tilesWithHitBox: string;\n };\n };\n\n export type SimpleTileMapObjectData = ObjectData &\n SimpleTileMapObjectDataType;\n\n export type SimpleTileMapNetworkSyncDataType = {\n op: number;\n ai: string;\n wid: number;\n hei: number;\n // TODO: Support tilemap synchronization. Find an efficient way to send tiles changes.\n };\n\n export type SimpleTileMapNetworkSyncData = ObjectNetworkSyncData &\n SimpleTileMapNetworkSyncDataType;\n\n /**\n * Displays a SimpleTileMap object.\n */\n export class SimpleTileMapRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.Scalable, gdjs.OpacityHandler {\n /**\n * A reusable Point to avoid allocations.\n */\n private static readonly workingPoint: FloatPoint = [0, 0];\n\n _opacity: float;\n _atlasImage: string;\n _tileMapManager: gdjs.TileMap.TileMapRuntimeManager;\n _renderer: gdjs.TileMapRuntimeObjectPixiRenderer;\n readonly _rowCount: number;\n readonly _columnCount: number;\n readonly _tileSize: number;\n _displayMode = 'all';\n _layerIndex = 0;\n _initialTileMapAsJsObject: TileMapHelper.EditableTileMapAsJsObject | null = null;\n readonly _initialTilesWithHitBox: number[];\n _isTileMapDirty: boolean = false;\n _sceneToTileMapTransformation: gdjs.AffineTransformation = new gdjs.AffineTransformation();\n _tileMapToSceneTransformation: gdjs.AffineTransformation = new gdjs.AffineTransformation();\n _collisionTileMap: gdjs.TileMap.TransformedCollisionTileMap | null = null;\n _hitBoxTag: string = 'collision';\n private _transformationIsUpToDate: boolean = false;\n\n // TODO: Add a debug mode like for TileMapCollisionMaskRuntimeObject to draw?\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: SimpleTileMapObjectDataType\n ) {\n super(instanceContainer, objectData);\n this._opacity = objectData.content.opacity;\n this._atlasImage = objectData.content.atlasImage;\n this._rowCount = objectData.content.rowCount;\n this._columnCount = objectData.content.columnCount;\n this._tileSize = objectData.content.tileSize;\n this._initialTilesWithHitBox = (objectData.content\n .tilesWithHitBox as string)\n .split(',')\n .filter((id) => !!id)\n .map((idAsString) => parseInt(idAsString, 10));\n this._tileMapManager = gdjs.TileMap.TileMapRuntimeManager.getManager(\n instanceContainer\n );\n this._renderer = new gdjs.TileMapRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n updatePreRender(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n if (this._isTileMapDirty) {\n let shouldContinue = true;\n this._tileMapManager.getOrLoadSimpleTileMapTextureCache(\n (textureName) => {\n return (this.getInstanceContainer()\n .getGame()\n .getImageManager()\n .getPIXITexture(textureName) as unknown) as PIXI.BaseTexture<\n PIXI.Resource\n >;\n },\n this._atlasImage,\n this._tileSize,\n this._columnCount,\n this._rowCount,\n (textureCache: TileMapHelper.TileTextureCache | null) => {\n if (!textureCache) {\n // getOrLoadTextureCache already log warns and errors.\n return;\n }\n this._renderer.refreshPixiTileMap(textureCache);\n },\n (error) => {\n shouldContinue = false;\n console.error(\n `Could not load texture cache for atlas ${this._atlasImage} during prerender. The tilemap might be badly configured or an issues happened with the loaded atlas image:`,\n error\n );\n }\n );\n if (!shouldContinue) return;\n if (this._collisionTileMap) {\n const tileMap = this._renderer.getTileMap();\n if (tileMap) this._collisionTileMap.updateFromTileMap(tileMap);\n }\n this._isTileMapDirty = false;\n }\n }\n\n updateFromObjectData(\n oldObjectData: SimpleTileMapObjectData,\n newObjectData: SimpleTileMapObjectData\n ): boolean {\n if (oldObjectData.content.opacity !== newObjectData.content.opacity) {\n this.setOpacity(newObjectData.content.opacity);\n }\n if (\n oldObjectData.content.atlasImage !== newObjectData.content.atlasImage\n ) {\n // TODO: support changing the atlas texture\n return false;\n }\n // Map content is updated at hot-reload by extraInitializationFromInitialInstance.\n return true;\n }\n\n getNetworkSyncData(): SimpleTileMapNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n op: this._opacity,\n ai: this._atlasImage,\n wid: this.getWidth(),\n hei: this.getHeight(),\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: SimpleTileMapNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n if (\n networkSyncData.op !== undefined &&\n networkSyncData.op !== this._opacity\n ) {\n this.setOpacity(networkSyncData.op);\n }\n if (\n networkSyncData.wid !== undefined &&\n networkSyncData.wid !== this.getWidth()\n ) {\n this.setWidth(networkSyncData.wid);\n }\n if (\n networkSyncData.hei !== undefined &&\n networkSyncData.hei !== this.getHeight()\n ) {\n this.setHeight(networkSyncData.hei);\n }\n if (networkSyncData.ai !== undefined) {\n // TODO: support changing the atlas texture\n }\n }\n\n extraInitializationFromInitialInstance(\n initialInstanceData: InstanceData\n ): void {\n // 1. load the tilemap from the instance.\n for (const property of initialInstanceData.stringProperties) {\n if (property.name === 'tilemap') {\n this._initialTileMapAsJsObject = JSON.parse(property.value);\n }\n }\n\n // 2. Update the renderer so that it updates the tilemap object\n // (used for width and position calculations).\n this._loadInitialTileMap((tileMap: TileMapHelper.EditableTileMap) => {\n // 3. Set custom dimensions & opacity if applicable.\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 // 4. Update position (calculations based on renderer's dimensions).\n this._renderer.updatePosition();\n\n if (this._collisionTileMap) {\n // If collision tile map is already defined, there's a good chance it means\n // extraInitializationFromInitialInstance is called when hot reloading the\n // scene so the collision is tile map is updated instead of being re-created.\n this._collisionTileMap.updateFromTileMap(tileMap);\n } else {\n this._collisionTileMap = new gdjs.TileMap.TransformedCollisionTileMap(\n tileMap,\n this._hitBoxTag\n );\n }\n\n this.updateTransformation();\n });\n }\n\n private _loadInitialTileMap(\n tileMapLoadingCallback: (tileMap: TileMapHelper.EditableTileMap) => void\n ): void {\n if (!this._initialTileMapAsJsObject) return;\n if (this._columnCount <= 0 || this._rowCount <= 0) {\n console.error(\n `Tilemap object ${this.name} is not configured properly.`\n );\n return;\n }\n\n this._tileMapManager.getOrLoadSimpleTileMap(\n this._initialTileMapAsJsObject,\n this.name,\n this._tileSize,\n this._columnCount,\n this._rowCount,\n (tileMap: TileMapHelper.EditableTileMap) => {\n this._initialTilesWithHitBox.forEach((tileId) => {\n const tileDefinition = tileMap.getTileDefinition(tileId);\n if (!tileDefinition) {\n console.warn(\n `Could not set hit box for tile with id ${tileId}. Continuing.`\n );\n return;\n }\n tileDefinition.addHitBox(\n this._hitBoxTag,\n [\n [0, 0],\n [0, tileMap.getTileHeight()],\n [tileMap.getTileWidth(), tileMap.getTileHeight()],\n [tileMap.getTileWidth(), 0],\n ],\n true\n );\n });\n\n this._tileMapManager.getOrLoadSimpleTileMapTextureCache(\n (textureName) => {\n return (this.getInstanceContainer()\n .getGame()\n .getImageManager()\n .getPIXITexture(textureName) as unknown) as PIXI.BaseTexture<\n PIXI.Resource\n >;\n },\n this._atlasImage,\n this._tileSize,\n this._columnCount,\n this._rowCount,\n (textureCache: TileMapHelper.TileTextureCache | null) => {\n if (!textureCache) {\n // getOrLoadTextureCache already log warns and errors.\n return;\n }\n this._renderer.updatePixiTileMap(tileMap, textureCache);\n tileMapLoadingCallback(tileMap);\n },\n (error) => {\n console.error(\n `Could not load texture cache for atlas ${this._atlasImage} during initial loading. The tilemap might be badly configured or an issues happened with the loaded atlas image:`,\n error\n );\n }\n );\n }\n );\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n setWidth(width: float): void {\n if (this.getWidth() === width) return;\n\n this._transformationIsUpToDate = false;\n this._renderer.setWidth(width);\n this.invalidateHitboxes();\n }\n\n setHeight(height: float): void {\n if (this.getHeight() === height) return;\n\n this._transformationIsUpToDate = false;\n this._renderer.setHeight(height);\n this.invalidateHitboxes();\n }\n\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n this._transformationIsUpToDate = false;\n }\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 = this.getScaleX();\n const scaleY = this.getScaleY();\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Change the scale on X and Y axis of the object.\n *\n * @param scale The new scale (must be greater than 0).\n */\n setScale(scale: float): void {\n this.setScaleX(scale);\n this.setScaleY(scale);\n this._transformationIsUpToDate = false;\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param scaleX The new scale (must be greater than 0).\n */\n setScaleX(scaleX: float): void {\n if (scaleX < 0) {\n scaleX = 0;\n }\n if (this.getScaleX() === scaleX) return;\n\n this._renderer.setScaleX(scaleX);\n this.invalidateHitboxes();\n this._transformationIsUpToDate = false;\n }\n\n /**\n * Change the scale on Y axis of the object (changing its width).\n *\n * @param scaleY The new scale (must be greater than 0).\n */\n setScaleY(scaleY: float): void {\n if (scaleY < 0) {\n scaleY = 0;\n }\n if (this.getScaleY() === scaleY) return;\n\n this._renderer.setScaleY(scaleY);\n this.invalidateHitboxes();\n this._transformationIsUpToDate = false;\n }\n\n setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n this._transformationIsUpToDate = false;\n }\n\n setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n this._transformationIsUpToDate = false;\n }\n\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n this._transformationIsUpToDate = false;\n }\n\n setOpacity(opacity: float): void {\n this._opacity = opacity;\n this._renderer.updateOpacity();\n this._isTileMapDirty = true;\n }\n\n getOpacity(): float {\n return this._opacity;\n }\n\n getWidth(): float {\n return this._renderer.getWidth();\n }\n\n getHeight(): float {\n return this._renderer.getHeight();\n }\n\n getScaleX(): float {\n return this._renderer.getScaleX();\n }\n\n getScaleY(): float {\n return this._renderer.getScaleY();\n }\n\n /**\n * This method is expensive and should not be called.\n * Prefer using {@link getHitBoxesAround} rather than getHitBoxes.\n */\n getHitBoxes(): gdjs.Polygon[] {\n if (this.hitBoxesDirty) {\n this.updateHitBoxes();\n this.updateAABB();\n this.hitBoxesDirty = false;\n }\n return this.hitBoxes;\n }\n\n updateHitBoxes(): void {\n this.updateTransformation();\n if (!this._collisionTileMap) return;\n this.hitBoxes = Array.from(\n this._collisionTileMap.getAllHitboxes(this._hitBoxTag)\n );\n this.hitBoxesDirty = false;\n this.updateAABB();\n }\n\n // This implementation doesn't use updateHitBoxes.\n // It's important for good performances.\n updateAABB(): void {\n if (this.getAngle() === 0) {\n // Fast computation of AABB for non rotated object\n this.aabb.min[0] = this.x;\n this.aabb.min[1] = this.y;\n this.aabb.max[0] = this.aabb.min[0] + this.getWidth();\n this.aabb.max[1] = this.aabb.min[1] + this.getHeight();\n } else {\n if (!this._collisionTileMap) return;\n const affineTransformation = this._collisionTileMap.getTransformation();\n\n const left = 0;\n const right = this._collisionTileMap.getWidth();\n const top = 0;\n const bottom = this._collisionTileMap.getHeight();\n\n const workingPoint = this.aabb.min;\n\n workingPoint[0] = left;\n workingPoint[1] = top;\n affineTransformation.transform(workingPoint, workingPoint);\n const topLeftX = workingPoint[0];\n const topLeftY = workingPoint[1];\n\n workingPoint[0] = right;\n workingPoint[1] = top;\n affineTransformation.transform(workingPoint, workingPoint);\n const topRightX = workingPoint[0];\n const topRightY = workingPoint[1];\n\n workingPoint[0] = right;\n workingPoint[1] = bottom;\n affineTransformation.transform(workingPoint, workingPoint);\n const bottomRightX = workingPoint[0];\n const bottomRightY = workingPoint[1];\n\n workingPoint[0] = left;\n workingPoint[1] = bottom;\n affineTransformation.transform(workingPoint, workingPoint);\n const bottomLeftX = workingPoint[0];\n const bottomLeftY = workingPoint[1];\n\n this.aabb.min[0] = Math.min(\n topLeftX,\n topRightX,\n bottomRightX,\n bottomLeftX\n );\n this.aabb.max[0] = Math.max(\n topLeftX,\n topRightX,\n bottomRightX,\n bottomLeftX\n );\n this.aabb.min[1] = Math.min(\n topLeftY,\n topRightY,\n bottomRightY,\n bottomLeftY\n );\n this.aabb.max[1] = Math.max(\n topLeftY,\n topRightY,\n bottomRightY,\n bottomLeftY\n );\n }\n }\n\n getHitBoxesAround(\n left: float,\n top: float,\n right: float,\n bottom: float\n ): Iterable<gdjs.Polygon> {\n // This implementation doesn't call updateHitBoxes.\n // It's important for good performances because there is no need to\n // update the whole collision mask where only a few hitboxes must be\n // checked.\n this.updateTransformation();\n if (!this._collisionTileMap) return [];\n return this._collisionTileMap.getHitboxesAround(\n this._hitBoxTag,\n left,\n top,\n right,\n bottom\n );\n }\n\n updateTransformation() {\n if (this._transformationIsUpToDate) {\n return;\n }\n const absScaleX = Math.abs(this._renderer.getScaleX());\n const absScaleY = Math.abs(this._renderer.getScaleY());\n\n this._tileMapToSceneTransformation.setToIdentity();\n\n // Translation\n this._tileMapToSceneTransformation.translate(this.getX(), this.getY());\n\n // Rotation\n const angleInRadians = (this.getAngle() * Math.PI) / 180;\n this._tileMapToSceneTransformation.rotateAround(\n angleInRadians,\n this.getCenterX(),\n this.getCenterY()\n );\n\n // Scale\n this._tileMapToSceneTransformation.scale(absScaleX, absScaleY);\n if (this._collisionTileMap) {\n const collisionTileMapTransformation = this._collisionTileMap.getTransformation();\n collisionTileMapTransformation.copyFrom(\n this._tileMapToSceneTransformation\n );\n this._collisionTileMap.setTransformation(\n collisionTileMapTransformation\n );\n }\n this._sceneToTileMapTransformation.copyFrom(\n this._tileMapToSceneTransformation\n );\n this._sceneToTileMapTransformation.invert();\n this._transformationIsUpToDate = true;\n }\n\n getSceneXCoordinateOfTileCenter(\n columnIndex: integer,\n rowIndex: integer\n ): float {\n const sceneCoordinates: FloatPoint =\n SimpleTileMapRuntimeObject.workingPoint;\n this._tileMapToSceneTransformation.transform(\n [\n (columnIndex + 0.5) * this._tileSize,\n (rowIndex + 0.5) * this._tileSize,\n ],\n sceneCoordinates\n );\n return sceneCoordinates[0];\n }\n\n getSceneYCoordinateOfTileCenter(\n columnIndex: integer,\n rowIndex: integer\n ): float {\n const sceneCoordinates: FloatPoint =\n SimpleTileMapRuntimeObject.workingPoint;\n this._tileMapToSceneTransformation.transform(\n [\n (columnIndex + 0.5) * this._tileSize,\n (rowIndex + 0.5) * this._tileSize,\n ],\n sceneCoordinates\n );\n return sceneCoordinates[1];\n }\n\n getGridCoordinatesFromSceneCoordinates(\n x: float,\n y: float\n ): [integer, integer] {\n this.updateTransformation();\n\n const gridCoordinates: FloatPoint =\n SimpleTileMapRuntimeObject.workingPoint;\n this._sceneToTileMapTransformation.transform([x, y], gridCoordinates);\n\n const columnIndex = Math.floor(gridCoordinates[0] / this._tileSize);\n const rowIndex = Math.floor(gridCoordinates[1] / this._tileSize);\n\n return [columnIndex, rowIndex];\n }\n\n getColumnIndexAtPosition(x: float, y: float): integer {\n return this.getGridCoordinatesFromSceneCoordinates(x, y)[0];\n }\n\n getRowIndexAtPosition(x: float, y: float): integer {\n return this.getGridCoordinatesFromSceneCoordinates(x, y)[1];\n }\n\n getTileAtPosition(x: float, y: float): integer {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n return this.getTileAtGridCoordinates(columnIndex, rowIndex);\n }\n\n getTileAtGridCoordinates(columnIndex: integer, rowIndex: integer): integer {\n return this._renderer.getTileId(columnIndex, rowIndex, 0);\n }\n\n setTileAtPosition(tileId: number, x: float, y: float) {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n this.setTileAtGridCoordinates(tileId, columnIndex, rowIndex);\n }\n\n setTileAtGridCoordinates(\n tileId: number,\n columnIndex: integer,\n rowIndex: integer\n ) {\n const tileMap = this._renderer._tileMap;\n if (!tileMap) {\n return;\n }\n const layer = tileMap.getTileLayer(this._layerIndex);\n if (!layer) {\n return;\n }\n const oldTileId = layer.getTileId(columnIndex, rowIndex);\n if (tileId === oldTileId) {\n return;\n }\n layer.setTile(columnIndex, rowIndex, tileId);\n\n if (this._collisionTileMap) {\n const oldTileDefinition =\n oldTileId !== undefined && tileMap.getTileDefinition(oldTileId);\n const newTileDefinition = tileMap.getTileDefinition(tileId);\n const hadFullHitBox =\n !!oldTileDefinition &&\n oldTileDefinition.hasFullHitBox(this._hitBoxTag);\n const haveFullHitBox =\n !!newTileDefinition &&\n newTileDefinition.hasFullHitBox(this._hitBoxTag);\n if (hadFullHitBox !== haveFullHitBox) {\n this._collisionTileMap.invalidateTile(\n this._layerIndex,\n columnIndex,\n rowIndex\n );\n }\n }\n this._isTileMapDirty = true;\n this.invalidateHitboxes();\n }\n\n flipTileOnYAtPosition(x: float, y: float, flip: boolean) {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n this.flipTileOnYAtGridCoordinates(columnIndex, rowIndex, flip);\n }\n\n flipTileOnXAtPosition(x: float, y: float, flip: boolean) {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n this.flipTileOnXAtGridCoordinates(columnIndex, rowIndex, flip);\n }\n\n flipTileOnYAtGridCoordinates(\n columnIndex: integer,\n rowIndex: integer,\n flip: boolean\n ) {\n this._renderer.flipTileOnY(columnIndex, rowIndex, 0, flip);\n this._isTileMapDirty = true;\n // No need to invalidate hit boxes since at the moment, collision mask\n // cannot be configured on each tile.\n }\n\n flipTileOnXAtGridCoordinates(\n columnIndex: integer,\n rowIndex: integer,\n flip: boolean\n ) {\n this._renderer.flipTileOnX(columnIndex, rowIndex, 0, flip);\n this._isTileMapDirty = true;\n // No need to invalidate hit boxes since at the moment, collision mask\n // cannot be configured on each tile.\n }\n\n isTileFlippedOnXAtPosition(x: float, y: float) {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n\n return this._renderer.isTileFlippedOnX(columnIndex, rowIndex, 0);\n }\n\n isTileFlippedOnXAtGridCoordinates(columnIndex: integer, rowIndex: integer) {\n return this._renderer.isTileFlippedOnX(columnIndex, rowIndex, 0);\n }\n\n isTileFlippedOnYAtPosition(x: float, y: float) {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n\n return this._renderer.isTileFlippedOnY(columnIndex, rowIndex, 0);\n }\n\n isTileFlippedOnYAtGridCoordinates(columnIndex: integer, rowIndex: integer) {\n return this._renderer.isTileFlippedOnY(columnIndex, rowIndex, 0);\n }\n\n removeTileAtPosition(x: float, y: float) {\n const [\n columnIndex,\n rowIndex,\n ] = this.getGridCoordinatesFromSceneCoordinates(x, y);\n this.removeTileAtGridCoordinates(columnIndex, rowIndex);\n }\n\n removeTileAtGridCoordinates(columnIndex: integer, rowIndex: integer) {\n const tileMap = this._renderer._tileMap;\n if (!tileMap) {\n return;\n }\n const layer = tileMap.getTileLayer(this._layerIndex);\n if (!layer) {\n return;\n }\n const oldTileId = layer.getTileId(columnIndex, rowIndex);\n if (oldTileId === undefined) {\n return;\n }\n layer.removeTile(columnIndex, rowIndex);\n if (this._collisionTileMap) {\n this._collisionTileMap.invalidateTile(\n this._layerIndex,\n columnIndex,\n rowIndex\n );\n }\n this._isTileMapDirty = true;\n this.invalidateHitboxes();\n }\n\n setGridRowCount(targetRowCount: integer) {\n if (targetRowCount <= 0) return;\n this._renderer.setGridRowCount(targetRowCount);\n this._isTileMapDirty = true;\n this.invalidateHitboxes();\n }\n\n setGridColumnCount(targetColumnCount: integer) {\n if (targetColumnCount <= 0) return;\n this._renderer.setGridColumnCount(targetColumnCount);\n this._isTileMapDirty = true;\n this.invalidateHitboxes();\n }\n\n getGridRowCount(): integer {\n return this._renderer.getGridRowCount();\n }\n\n getGridColumnCount(): integer {\n return this._renderer.getGridColumnCount();\n }\n\n getTilesetColumnCount(): integer {\n return this._columnCount;\n }\n\n getTilesetRowCount(): integer {\n return this._rowCount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AAU,EAAa,KAC7B,QAGlB,GAAM,WAAW,EAAa,GAC1B,KAAK,mBACP,KAAK,kBAAkB,eACrB,KAAK,YACL,EACA,GAGJ,KAAK,gBAAkB,GACvB,KAAK,sBAGP,gBAAgB,EAAyB,CACvC,AAAI,GAAkB,GACtB,MAAK,UAAU,gBAAgB,GAC/B,KAAK,gBAAkB,GACvB,KAAK,sBAGP,mBAAmB,EAA4B,CAC7C,AAAI,GAAqB,GACzB,MAAK,UAAU,mBAAmB,GAClC,KAAK,gBAAkB,GACvB,KAAK,sBAGP,iBAA2B,CACzB,MAAO,MAAK,UAAU,kBAGxB,oBAA8B,CAC5B,MAAO,MAAK,UAAU,qBAGxB,uBAAiC,CAC/B,MAAO,MAAK,aAGd,oBAA8B,CAC5B,MAAO,MAAK,YAhxBT,QAMmB,AANnB,EAMmB,aAA2B,CAAC,EAAG,GANlD,EAAM,6BAmxBb,EAAK,eACH,yBACA,EAAK,8BAlzBC",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(s){class _ extends s.RuntimeObject{constructor(i,t){super(i,t);this._transformationIsUpToDate=!1;this._tilemapJsonFile=t.content.tilemapJsonFile,this._tilesetJsonFile=t.content.tilesetJsonFile,this._collisionMaskTag=t.content.collisionMaskTag,this._debugMode=t.content.debugMode,this._fillColor=s.rgbOrHexStringToNumber(t.content.fillColor),this._outlineColor=s.rgbOrHexStringToNumber(t.content.outlineColor),this._fillOpacity=t.content.fillOpacity,this._outlineOpacity=t.content.outlineOpacity,this._outlineSize=t.content.outlineSize,this._tileMapManager=s.TileMap.TileMapRuntimeManager.getManager(i),this._width=0,this._height=0,this._scaleX=1,this._scaleY=1;const o=new TileMapHelper.EditableTileMap(1,1,0,0,new Map);this._collisionTileMap=new s.TileMap.TransformedCollisionTileMap(o,this._collisionMaskTag),this._renderer=new s.TileMap.TileMapCollisionMaskRenderer(this,i),this._updateTileMap(),this.onCreated()}updatePreRender(i){super.updatePreRender(i),this._debugMode&&this.hitBoxesDirty&&this.updateHitBoxes()}getRendererObject(){return this._renderer.getRendererObject()}getVisibilityAABB(){return null}updateFromObjectData(i,t){return i.content.tilemapJsonFile!==t.content.tilemapJsonFile&&this.setTilemapJsonFile(t.content.tilemapJsonFile),i.content.tilesetJsonFile!==t.content.tilesetJsonFile&&this.setTilesetJsonFile(t.content.tilesetJsonFile),i.content.debugMode!==t.content.debugMode&&this.setDebugMode(t.content.debugMode),i.content.fillColor!==t.content.fillColor&&this.setFillColor(s.rgbOrHexStringToNumber(t.content.fillColor)),i.content.outlineColor!==t.content.outlineColor&&this.setOutlineColor(s.rgbOrHexStringToNumber(t.content.outlineColor)),i.fillOpacity!==t.fillOpacity&&this.setFillOpacity(t.fillOpacity),i.outlineOpacity!==t.outlineOpacity&&this.setOutlineOpacity(t.outlineOpacity),i.outlineSize!==t.outlineSize&&this.setOutlineSize(t.outlineSize),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),tmjf:this.getTilemapJsonFile(),tsjf:this.getTilesetJsonFile(),dm:this.getDebugMode(),oc:this.getOutlineColor(),fc:this.getFillColor(),os:this.getOutlineSize(),fo:this.getFillOpacity(),oo:this.getOutlineOpacity(),wid:this.getWidth(),hei:this.getHeight()}}updateFromNetworkSyncData(i){super.updateFromNetworkSyncData(i),i.tmjf!==void 0&&this.setTilemapJsonFile(i.tmjf),i.tsjf!==void 0&&this.setTilesetJsonFile(i.tsjf),i.dm!==void 0&&this.setDebugMode(i.dm),i.oc!==void 0&&this.setOutlineColor(i.oc),i.fc!==void 0&&this.setFillColor(i.fc),i.os!==void 0&&this.setOutlineSize(i.os),i.fo!==void 0&&this.setFillOpacity(i.fo),i.oo!==void 0&&this.setOutlineOpacity(i.oo),i.wid!==void 0&&this.setWidth(i.wid),i.hei!==void 0&&this.setHeight(i.hei)}extraInitializationFromInitialInstance(i){i.customSize&&(this.setWidth(i.width),this.setHeight(i.height))}_updateTileMap(){this._tileMapManager.getOrLoadTileMap(this._tilemapJsonFile,this._tilesetJsonFile,0,i=>{!i||(this._collisionTileMap=new s.TileMap.TransformedCollisionTileMap(i,this._collisionMaskTag),this.hitBoxes=Array.from(this._collisionTileMap.getAllHitboxes(this._collisionMaskTag)),this._renderer.redrawCollisionMask(),this._width=this._collisionTileMap.getWidth()*this._scaleX,this._height=this._collisionTileMap.getHeight()*this._scaleY)})}updateHitBoxes(){this.updateTransformation();for(const i of this._collisionTileMap.getAllHitboxes(this._collisionMaskTag));this.hitBoxesDirty=!1,this._renderer.redrawCollisionMask(),this.updateAABB()}updateTransformation(){if(this._transformationIsUpToDate)return;const i=this._collisionTileMap.getTransformation(),t=Math.abs(this._scaleX),o=Math.abs(this._scaleY);i.setToIdentity(),i.translate(this.x,this.y);const l=this.angle*Math.PI/180;i.rotateAround(l,this.getCenterX(),this.getCenterY()),i.scale(t,o),this._collisionTileMap.setTransformation(i),this._transformationIsUpToDate=!0}getHitBoxes(){return this.hitBoxesDirty&&(this.updateHitBoxes(),this.updateAABB(),this.hitBoxesDirty=!1),this.hitBoxes}getHitBoxesAround(i,t,o,l){return this.updateTransformation(),this._collisionTileMap.getHitboxesAround(this._collisionMaskTag,i,t,o,l)}insideObject(i,t){return this.updateTransformation(),this._collisionTileMap.pointIsInsideTile(i,t,this._collisionMaskTag)}updateAABB(){if(this.getAngle()===0)this.aabb.min[0]=this.x,this.aabb.min[1]=this.y,this.aabb.max[0]=this.aabb.min[0]+this.getWidth(),this.aabb.max[1]=this.aabb.min[1]+this.getHeight();else{const i=this._collisionTileMap.getTransformation(),t=0,o=this._collisionTileMap.getWidth(),l=0,n=this._collisionTileMap.getHeight(),e=this.aabb.min;e[0]=t,e[1]=l,i.transform(e,e);const a=e[0],r=e[1];e[0]=o,e[1]=l,i.transform(e,e);const h=e[0],p=e[1];e[0]=o,e[1]=n,i.transform(e,e);const f=e[0],g=e[1];e[0]=t,e[1]=n,i.transform(e,e);const d=e[0],u=e[1];this.aabb.min[0]=Math.min(a,h,f,d),this.aabb.max[0]=Math.max(a,h,f,d),this.aabb.min[1]=Math.min(r,p,g,u),this.aabb.max[1]=Math.max(r,p,g,u)}}setTilemapJsonFile(i){this._tilemapJsonFile=i,this._updateTileMap()}getTilemapJsonFile(){return this._tilemapJsonFile}isTilemapJsonFile(i){return this._tilemapJsonFile===i}setTilesetJsonFile(i){this._tilesetJsonFile=i,this._updateTileMap()}getTilesetJsonFile(){return this._tilesetJsonFile}isTilesetJsonFile(i){return this._tilesetJsonFile===i}getDebugMode(){return this._debugMode}setDebugMode(i){this._debugMode=i,this._renderer.redrawCollisionMask()}getFillColor(){return this._fillColor}getOutlineColor(){return this._outlineColor}setFillColor(i){this._fillColor=i}setOutlineColor(i){this._outlineColor=i}setOutlineSize(i){this._outlineSize=i}getOutlineSize(){return this._outlineSize}setFillOpacity(i){this._fillOpacity=i}getFillOpacity(){return this._fillOpacity}setOutlineOpacity(i){this._outlineOpacity=i}getOutlineOpacity(){return this._outlineOpacity}setX(i){super.setX(i),this._transformationIsUpToDate=!1}setY(i){super.setY(i),this._transformationIsUpToDate=!1}setAngle(i){super.setAngle(i),this._transformationIsUpToDate=!1}setWidth(i){this._width!==i&&(this._scaleX=i/this._collisionTileMap.getWidth(),this._width=i,this._transformationIsUpToDate=!1,this.invalidateHitboxes())}setHeight(i){this._height!==i&&(this._scaleY=i/this._collisionTileMap.getHeight(),this._height=i,this._transformationIsUpToDate=!1,this.invalidateHitboxes())}setSize(i,t){this.setWidth(i),this.setHeight(t)}getScale(){const i=this.getScaleX(),t=this.getScaleY();return i===t?i:Math.sqrt(i*t)}setScale(i){this.setScaleX(i),this.setScaleY(i)}setScaleX(i){i<0&&(i=0),this._scaleX!==i&&(this._scaleX=i,this._width=i*this._collisionTileMap.getWidth(),this._transformationIsUpToDate=!1,this.invalidateHitboxes())}setScaleY(i){i<0&&(i=0),this._scaleY!==i&&(this._scaleY=i,this._height=i*this._collisionTileMap.getHeight(),this._transformationIsUpToDate=!1,this.invalidateHitboxes())}getWidth(){return this._width}getHeight(){return this._height}getScaleX(){return this._scaleX}getScaleY(){return this._scaleY}}s.TileMapCollisionMaskRuntimeObject=_,s.registerObject("TileMap::CollisionMask",s.TileMapCollisionMaskRuntimeObject),_.supportsReinitialization=!1})(gdjs||(gdjs={}));
1
+ var gdjs;(function(s){class _ extends s.RuntimeObject{constructor(i,t){super(i,t);this._transformationIsUpToDate=!1;this._tilemapJsonFile=t.content.tilemapJsonFile,this._tilesetJsonFile=t.content.tilesetJsonFile,this._collisionMaskTag=t.content.collisionMaskTag,this._layerIndex=t.content.useAllLayers||t.content.useAllLayers===void 0?null:Number.isFinite(t.content.layerIndex)?t.content.layerIndex:1,this._debugMode=t.content.debugMode,this._fillColor=s.rgbOrHexStringToNumber(t.content.fillColor),this._outlineColor=s.rgbOrHexStringToNumber(t.content.outlineColor),this._fillOpacity=t.content.fillOpacity,this._outlineOpacity=t.content.outlineOpacity,this._outlineSize=t.content.outlineSize,this._tileMapManager=s.TileMap.TileMapRuntimeManager.getManager(i),this._width=0,this._height=0,this._scaleX=1,this._scaleY=1;const o=new TileMapHelper.EditableTileMap(1,1,0,0,new Map);this._collisionTileMap=new s.TileMap.TransformedCollisionTileMap(o,this._collisionMaskTag,this._layerIndex),this._renderer=new s.TileMap.TileMapCollisionMaskRenderer(this,i),this._updateTileMap(),this.onCreated()}updatePreRender(i){super.updatePreRender(i),this._debugMode&&this.hitBoxesDirty&&this.updateHitBoxes()}getRendererObject(){return this._renderer.getRendererObject()}getVisibilityAABB(){return null}updateFromObjectData(i,t){return i.content.tilemapJsonFile!==t.content.tilemapJsonFile&&this.setTilemapJsonFile(t.content.tilemapJsonFile),i.content.tilesetJsonFile!==t.content.tilesetJsonFile&&this.setTilesetJsonFile(t.content.tilesetJsonFile),i.content.debugMode!==t.content.debugMode&&this.setDebugMode(t.content.debugMode),i.content.fillColor!==t.content.fillColor&&this.setFillColor(s.rgbOrHexStringToNumber(t.content.fillColor)),i.content.outlineColor!==t.content.outlineColor&&this.setOutlineColor(s.rgbOrHexStringToNumber(t.content.outlineColor)),i.fillOpacity!==t.fillOpacity&&this.setFillOpacity(t.fillOpacity),i.outlineOpacity!==t.outlineOpacity&&this.setOutlineOpacity(t.outlineOpacity),i.outlineSize!==t.outlineSize&&this.setOutlineSize(t.outlineSize),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),tmjf:this.getTilemapJsonFile(),tsjf:this.getTilesetJsonFile(),dm:this.getDebugMode(),oc:this.getOutlineColor(),fc:this.getFillColor(),os:this.getOutlineSize(),fo:this.getFillOpacity(),oo:this.getOutlineOpacity(),wid:this.getWidth(),hei:this.getHeight()}}updateFromNetworkSyncData(i){super.updateFromNetworkSyncData(i),i.tmjf!==void 0&&this.setTilemapJsonFile(i.tmjf),i.tsjf!==void 0&&this.setTilesetJsonFile(i.tsjf),i.dm!==void 0&&this.setDebugMode(i.dm),i.oc!==void 0&&this.setOutlineColor(i.oc),i.fc!==void 0&&this.setFillColor(i.fc),i.os!==void 0&&this.setOutlineSize(i.os),i.fo!==void 0&&this.setFillOpacity(i.fo),i.oo!==void 0&&this.setOutlineOpacity(i.oo),i.wid!==void 0&&this.setWidth(i.wid),i.hei!==void 0&&this.setHeight(i.hei)}extraInitializationFromInitialInstance(i){i.customSize&&(this.setWidth(i.width),this.setHeight(i.height))}_updateTileMap(){this._tileMapManager.getOrLoadTileMap(this._tilemapJsonFile,this._tilesetJsonFile,0,i=>{!i||(this._collisionTileMap=new s.TileMap.TransformedCollisionTileMap(i,this._collisionMaskTag,this._layerIndex),this.hitBoxes=Array.from(this._collisionTileMap.getAllHitboxes(this._collisionMaskTag)),this._renderer.redrawCollisionMask(),this._width=this._collisionTileMap.getWidth()*this._scaleX,this._height=this._collisionTileMap.getHeight()*this._scaleY)})}updateHitBoxes(){this.updateTransformation();for(const i of this._collisionTileMap.getAllHitboxes(this._collisionMaskTag));this.hitBoxesDirty=!1,this._renderer.redrawCollisionMask(),this.updateAABB()}updateTransformation(){if(this._transformationIsUpToDate)return;const i=this._collisionTileMap.getTransformation(),t=Math.abs(this._scaleX),o=Math.abs(this._scaleY);i.setToIdentity(),i.translate(this.x,this.y);const l=this.angle*Math.PI/180;i.rotateAround(l,this.getCenterX(),this.getCenterY()),i.scale(t,o),this._collisionTileMap.setTransformation(i),this._transformationIsUpToDate=!0}getHitBoxes(){return this.hitBoxesDirty&&(this.updateHitBoxes(),this.updateAABB(),this.hitBoxesDirty=!1),this.hitBoxes}getHitBoxesAround(i,t,o,l){return this.updateTransformation(),this._collisionTileMap.getHitboxesAround(this._collisionMaskTag,i,t,o,l)}insideObject(i,t){return this.updateTransformation(),this._collisionTileMap.pointIsInsideTile(i,t,this._collisionMaskTag)}updateAABB(){if(this.getAngle()===0)this.aabb.min[0]=this.x,this.aabb.min[1]=this.y,this.aabb.max[0]=this.aabb.min[0]+this.getWidth(),this.aabb.max[1]=this.aabb.min[1]+this.getHeight();else{const i=this._collisionTileMap.getTransformation(),t=0,o=this._collisionTileMap.getWidth(),l=0,n=this._collisionTileMap.getHeight(),e=this.aabb.min;e[0]=t,e[1]=l,i.transform(e,e);const a=e[0],r=e[1];e[0]=o,e[1]=l,i.transform(e,e);const h=e[0],p=e[1];e[0]=o,e[1]=n,i.transform(e,e);const f=e[0],d=e[1];e[0]=t,e[1]=n,i.transform(e,e);const g=e[0],u=e[1];this.aabb.min[0]=Math.min(a,h,f,g),this.aabb.max[0]=Math.max(a,h,f,g),this.aabb.min[1]=Math.min(r,p,d,u),this.aabb.max[1]=Math.max(r,p,d,u)}}setTilemapJsonFile(i){this._tilemapJsonFile=i,this._updateTileMap()}getTilemapJsonFile(){return this._tilemapJsonFile}isTilemapJsonFile(i){return this._tilemapJsonFile===i}setTilesetJsonFile(i){this._tilesetJsonFile=i,this._updateTileMap()}getTilesetJsonFile(){return this._tilesetJsonFile}isTilesetJsonFile(i){return this._tilesetJsonFile===i}getDebugMode(){return this._debugMode}setDebugMode(i){this._debugMode=i,this._renderer.redrawCollisionMask()}getFillColor(){return this._fillColor}getOutlineColor(){return this._outlineColor}setFillColor(i){this._fillColor=i}setOutlineColor(i){this._outlineColor=i}setOutlineSize(i){this._outlineSize=i}getOutlineSize(){return this._outlineSize}setFillOpacity(i){this._fillOpacity=i}getFillOpacity(){return this._fillOpacity}setOutlineOpacity(i){this._outlineOpacity=i}getOutlineOpacity(){return this._outlineOpacity}setX(i){super.setX(i),this._transformationIsUpToDate=!1}setY(i){super.setY(i),this._transformationIsUpToDate=!1}setAngle(i){super.setAngle(i),this._transformationIsUpToDate=!1}setWidth(i){this._width!==i&&(this._scaleX=i/this._collisionTileMap.getWidth(),this._width=i,this._transformationIsUpToDate=!1,this.invalidateHitboxes())}setHeight(i){this._height!==i&&(this._scaleY=i/this._collisionTileMap.getHeight(),this._height=i,this._transformationIsUpToDate=!1,this.invalidateHitboxes())}setSize(i,t){this.setWidth(i),this.setHeight(t)}getScale(){const i=this.getScaleX(),t=this.getScaleY();return i===t?i:Math.sqrt(i*t)}setScale(i){this.setScaleX(i),this.setScaleY(i)}setScaleX(i){i<0&&(i=0),this._scaleX!==i&&(this._scaleX=i,this._width=i*this._collisionTileMap.getWidth(),this._transformationIsUpToDate=!1,this.invalidateHitboxes())}setScaleY(i){i<0&&(i=0),this._scaleY!==i&&(this._scaleY=i,this._height=i*this._collisionTileMap.getHeight(),this._transformationIsUpToDate=!1,this.invalidateHitboxes())}getWidth(){return this._width}getHeight(){return this._height}getScaleX(){return this._scaleX}getScaleY(){return this._scaleY}}s.TileMapCollisionMaskRuntimeObject=_,s.registerObject("TileMap::CollisionMask",s.TileMapCollisionMaskRuntimeObject),_.supportsReinitialization=!1})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=tilemapcollisionmaskruntimeobject.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/TileMap/tilemapcollisionmaskruntimeobject.ts"],
4
- "sourcesContent": ["/// <reference path=\"helper/TileMapHelper.d.ts\" />\nnamespace gdjs {\n export type TilemapCollisionMaskObjectDataType = {\n content: {\n tilemapJsonFile: string;\n tilesetJsonFile: string;\n collisionMaskTag: string;\n debugMode: boolean;\n fillColor: string;\n outlineColor: string;\n };\n fillOpacity: float;\n outlineOpacity: float;\n outlineSize: float;\n };\n\n export type TilemapCollisionMaskObjectData = ObjectData &\n TilemapCollisionMaskObjectDataType;\n\n export type TilemapCollisionMaskNetworkSyncDataType = {\n tmjf: string;\n tsjf: string;\n dm: boolean;\n oc: integer;\n fc: integer;\n os: float;\n fo: float;\n oo: float;\n wid: float;\n hei: float;\n };\n\n export type TilemapCollisionMaskNetworkSyncData = ObjectNetworkSyncData &\n TilemapCollisionMaskNetworkSyncDataType;\n\n /**\n * An object that handle hitboxes for a tile map.\n * @extends gdjs.RuntimeObject\n */\n export class TileMapCollisionMaskRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.Scalable {\n private _tilemapJsonFile: string;\n private _tilesetJsonFile: string;\n private _renderer: gdjs.TileMap.TileMapCollisionMaskRenderer;\n _collisionTileMap: gdjs.TileMap.TransformedCollisionTileMap;\n /**\n * The tiles are filtered according to this tag.\n *\n * This allows have multiple objects with different usage\n * for the same tile map.\n * For instance, platforms, jumpthru, ladder, spike, water...\n */\n private _collisionMaskTag: string;\n private _tileMapManager: gdjs.TileMap.TileMapRuntimeManager;\n\n /**\n * When set to true, the hitboxes will be shown.\n */\n _debugMode: boolean;\n _fillColor: integer;\n _outlineColor: integer;\n _fillOpacity: float;\n _outlineOpacity: float;\n _outlineSize: float;\n\n _width: float;\n _height: float;\n _scaleX: float;\n _scaleY: float;\n\n /**\n * If the owner moves, the hitboxes vertices\n * will have to be transformed again.\n */\n private _transformationIsUpToDate: boolean = false;\n\n constructor(instanceContainer: gdjs.RuntimeInstanceContainer, objectData) {\n super(instanceContainer, objectData);\n this._tilemapJsonFile = objectData.content.tilemapJsonFile;\n this._tilesetJsonFile = objectData.content.tilesetJsonFile;\n this._collisionMaskTag = objectData.content.collisionMaskTag;\n this._debugMode = objectData.content.debugMode;\n this._fillColor = gdjs.rgbOrHexStringToNumber(\n objectData.content.fillColor\n );\n this._outlineColor = gdjs.rgbOrHexStringToNumber(\n objectData.content.outlineColor\n );\n this._fillOpacity = objectData.content.fillOpacity;\n this._outlineOpacity = objectData.content.outlineOpacity;\n this._outlineSize = objectData.content.outlineSize;\n this._tileMapManager = gdjs.TileMap.TileMapRuntimeManager.getManager(\n instanceContainer\n );\n\n // The actual size is set when the tile map file is loaded.\n this._width = 0;\n this._height = 0;\n this._scaleX = 1;\n this._scaleY = 1;\n const editableTileMap = new TileMapHelper.EditableTileMap(\n 1,\n 1,\n 0,\n 0,\n new Map()\n );\n this._collisionTileMap = new gdjs.TileMap.TransformedCollisionTileMap(\n editableTileMap,\n this._collisionMaskTag\n );\n\n this._renderer = new gdjs.TileMap.TileMapCollisionMaskRenderer(\n this,\n instanceContainer\n );\n this._updateTileMap();\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n updatePreRender(instanceContainer: gdjs.RuntimeInstanceContainer) {\n super.updatePreRender(instanceContainer);\n\n if (this._debugMode && this.hitBoxesDirty) {\n this.updateHitBoxes();\n }\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n getVisibilityAABB() {\n return null;\n }\n\n updateFromObjectData(\n oldObjectData: TilemapCollisionMaskObjectData,\n newObjectData: TilemapCollisionMaskObjectData\n ): boolean {\n if (\n oldObjectData.content.tilemapJsonFile !==\n newObjectData.content.tilemapJsonFile\n ) {\n this.setTilemapJsonFile(newObjectData.content.tilemapJsonFile);\n }\n if (\n oldObjectData.content.tilesetJsonFile !==\n newObjectData.content.tilesetJsonFile\n ) {\n this.setTilesetJsonFile(newObjectData.content.tilesetJsonFile);\n }\n if (oldObjectData.content.debugMode !== newObjectData.content.debugMode) {\n this.setDebugMode(newObjectData.content.debugMode);\n }\n if (oldObjectData.content.fillColor !== newObjectData.content.fillColor) {\n this.setFillColor(\n gdjs.rgbOrHexStringToNumber(newObjectData.content.fillColor)\n );\n }\n if (\n oldObjectData.content.outlineColor !==\n newObjectData.content.outlineColor\n ) {\n this.setOutlineColor(\n gdjs.rgbOrHexStringToNumber(newObjectData.content.outlineColor)\n );\n }\n if (oldObjectData.fillOpacity !== newObjectData.fillOpacity) {\n this.setFillOpacity(newObjectData.fillOpacity);\n }\n if (oldObjectData.outlineOpacity !== newObjectData.outlineOpacity) {\n this.setOutlineOpacity(newObjectData.outlineOpacity);\n }\n if (oldObjectData.outlineSize !== newObjectData.outlineSize) {\n this.setOutlineSize(newObjectData.outlineSize);\n }\n return true;\n }\n\n getNetworkSyncData(): TilemapCollisionMaskNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n tmjf: this.getTilemapJsonFile(),\n tsjf: this.getTilesetJsonFile(),\n dm: this.getDebugMode(),\n oc: this.getOutlineColor(),\n fc: this.getFillColor(),\n os: this.getOutlineSize(),\n fo: this.getFillOpacity(),\n oo: this.getOutlineOpacity(),\n wid: this.getWidth(),\n hei: this.getHeight(),\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: TilemapCollisionMaskNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n if (networkSyncData.tmjf !== undefined) {\n this.setTilemapJsonFile(networkSyncData.tmjf);\n }\n if (networkSyncData.tsjf !== undefined) {\n this.setTilesetJsonFile(networkSyncData.tsjf);\n }\n if (networkSyncData.dm !== undefined) {\n this.setDebugMode(networkSyncData.dm);\n }\n if (networkSyncData.oc !== undefined) {\n this.setOutlineColor(networkSyncData.oc);\n }\n if (networkSyncData.fc !== undefined) {\n this.setFillColor(networkSyncData.fc);\n }\n if (networkSyncData.os !== undefined) {\n this.setOutlineSize(networkSyncData.os);\n }\n if (networkSyncData.fo !== undefined) {\n this.setFillOpacity(networkSyncData.fo);\n }\n if (networkSyncData.oo !== undefined) {\n this.setOutlineOpacity(networkSyncData.oo);\n }\n if (networkSyncData.wid !== undefined) {\n this.setWidth(networkSyncData.wid);\n }\n if (networkSyncData.hei !== undefined) {\n this.setHeight(networkSyncData.hei);\n }\n }\n\n extraInitializationFromInitialInstance(initialInstanceData): void {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n }\n\n private _updateTileMap(): void {\n this._tileMapManager.getOrLoadTileMap(\n this._tilemapJsonFile,\n this._tilesetJsonFile,\n 0, // levelIndex\n (tileMap: TileMapHelper.EditableTileMap | null) => {\n if (!tileMap) {\n // getOrLoadTileMap already log errors.\n return;\n }\n\n this._collisionTileMap = new gdjs.TileMap.TransformedCollisionTileMap(\n tileMap,\n this._collisionMaskTag\n );\n // The tile map polygons always keep the same references.\n // It works because the tilemap is never modified.\n this.hitBoxes = Array.from(\n this._collisionTileMap.getAllHitboxes(this._collisionMaskTag)\n );\n this._renderer.redrawCollisionMask();\n\n this._width = this._collisionTileMap.getWidth() * this._scaleX;\n this._height = this._collisionTileMap.getHeight() * this._scaleY;\n }\n );\n }\n\n updateHitBoxes(): void {\n this.updateTransformation();\n // Update the RuntimeObject hitboxes attribute.\n for (const _ of this._collisionTileMap.getAllHitboxes(\n this._collisionMaskTag\n )) {\n // RuntimeObject.hitBoxes contains the same polygons instances as the\n // hitboxes from the tiles.\n //\n // When hitboxes for a tile is asked to the model, they are updated\n // according to the new object location if needed.\n // Iterating over all the tiles forces them to update their hitboxes.\n //\n // The hitboxes array is built by _updateTileMap().\n }\n this.hitBoxesDirty = false;\n this._renderer.redrawCollisionMask();\n this.updateAABB();\n }\n\n /**\n * Update the affine transformation according to the object position, size\n * and angle.\n */\n updateTransformation(): void {\n if (this._transformationIsUpToDate) {\n return;\n }\n const transformation = this._collisionTileMap.getTransformation();\n\n const absScaleX = Math.abs(this._scaleX);\n const absScaleY = Math.abs(this._scaleY);\n\n transformation.setToIdentity();\n\n // Translation\n transformation.translate(this.x, this.y);\n\n // Rotation\n const angleInRadians = (this.angle * Math.PI) / 180;\n transformation.rotateAround(\n angleInRadians,\n this.getCenterX(),\n this.getCenterY()\n );\n\n // Scale\n transformation.scale(absScaleX, absScaleY);\n\n this._collisionTileMap.setTransformation(transformation);\n\n this._transformationIsUpToDate = true;\n }\n\n /**\n * This method is expensive and should not be called.\n * Prefer using {@link getHitBoxesAround} rather than getHitBoxes.\n */\n getHitBoxes(): gdjs.Polygon[] {\n if (this.hitBoxesDirty) {\n this.updateHitBoxes();\n this.updateAABB();\n this.hitBoxesDirty = false;\n }\n return this.hitBoxes;\n }\n\n getHitBoxesAround(left: float, top: float, right: float, bottom: float) {\n // This implementation doesn't call updateHitBoxes.\n // It's important for good performances because there is no need to\n // update the whole collision mask where only a few hitboxes must be\n // checked.\n this.updateTransformation();\n return this._collisionTileMap.getHitboxesAround(\n this._collisionMaskTag,\n left,\n top,\n right,\n bottom\n );\n }\n\n /**\n * insideObject usually use the AABB of the object.\n * But, in case of a tile map, it makes more sense to look each tile individually.\n * It returns true when there is an hitbox in the tile.\n */\n insideObject(x: float, y: float): boolean {\n this.updateTransformation();\n // This is more precise than the default implementation.\n return this._collisionTileMap.pointIsInsideTile(\n x,\n y,\n this._collisionMaskTag\n );\n }\n\n // This implementation doesn't use updateHitBoxes.\n // It's important for good performances.\n updateAABB(): void {\n if (this.getAngle() === 0) {\n // Fast computation of AABB for non rotated object\n this.aabb.min[0] = this.x;\n this.aabb.min[1] = this.y;\n this.aabb.max[0] = this.aabb.min[0] + this.getWidth();\n this.aabb.max[1] = this.aabb.min[1] + this.getHeight();\n } else {\n const affineTransformation = this._collisionTileMap.getTransformation();\n\n const left = 0;\n const right = this._collisionTileMap.getWidth();\n const top = 0;\n const bottom = this._collisionTileMap.getHeight();\n\n const workingPoint = this.aabb.min;\n\n workingPoint[0] = left;\n workingPoint[1] = top;\n affineTransformation.transform(workingPoint, workingPoint);\n const topLeftX = workingPoint[0];\n const topLeftY = workingPoint[1];\n\n workingPoint[0] = right;\n workingPoint[1] = top;\n affineTransformation.transform(workingPoint, workingPoint);\n const topRightX = workingPoint[0];\n const topRightY = workingPoint[1];\n\n workingPoint[0] = right;\n workingPoint[1] = bottom;\n affineTransformation.transform(workingPoint, workingPoint);\n const bottomRightX = workingPoint[0];\n const bottomRightY = workingPoint[1];\n\n workingPoint[0] = left;\n workingPoint[1] = bottom;\n affineTransformation.transform(workingPoint, workingPoint);\n const bottomLeftX = workingPoint[0];\n const bottomLeftY = workingPoint[1];\n\n this.aabb.min[0] = Math.min(\n topLeftX,\n topRightX,\n bottomRightX,\n bottomLeftX\n );\n this.aabb.max[0] = Math.max(\n topLeftX,\n topRightX,\n bottomRightX,\n bottomLeftX\n );\n this.aabb.min[1] = Math.min(\n topLeftY,\n topRightY,\n bottomRightY,\n bottomLeftY\n );\n this.aabb.max[1] = Math.max(\n topLeftY,\n topRightY,\n bottomRightY,\n bottomLeftY\n );\n }\n }\n\n /**\n * Set the Tilemap json file to display.\n */\n setTilemapJsonFile(tilemapJsonFile: string): void {\n this._tilemapJsonFile = tilemapJsonFile;\n this._updateTileMap();\n }\n\n getTilemapJsonFile(): string {\n return this._tilemapJsonFile;\n }\n\n isTilemapJsonFile(selectedTilemapJsonFile: string): boolean {\n return this._tilemapJsonFile === selectedTilemapJsonFile;\n }\n\n setTilesetJsonFile(tilesetJsonFile: string) {\n this._tilesetJsonFile = tilesetJsonFile;\n this._updateTileMap();\n }\n\n getTilesetJsonFile(): string {\n return this._tilesetJsonFile;\n }\n\n isTilesetJsonFile(selectedTilesetJsonFile: string): boolean {\n return this._tilesetJsonFile === selectedTilesetJsonFile;\n }\n\n /**\n * @returns true if the hitboxes are shown.\n */\n getDebugMode(): boolean {\n return this._debugMode;\n }\n\n /**\n * @returns true if the hitboxes are shown.\n */\n setDebugMode(debugMode: boolean): void {\n this._debugMode = debugMode;\n this._renderer.redrawCollisionMask();\n }\n\n getFillColor(): integer {\n return this._fillColor;\n }\n\n getOutlineColor(): integer {\n return this._outlineColor;\n }\n\n setFillColor(fillColor: integer): void {\n this._fillColor = fillColor;\n }\n\n setOutlineColor(outlineColor: integer): void {\n this._outlineColor = outlineColor;\n }\n\n setOutlineSize(size: float): void {\n this._outlineSize = size;\n }\n\n getOutlineSize(): float {\n return this._outlineSize;\n }\n\n /**\n *\n * @param opacity from 0 to 255\n */\n setFillOpacity(opacity: float): void {\n this._fillOpacity = opacity;\n }\n\n /**\n *\n * @returns an opacity value from 0 to 255.\n */\n getFillOpacity(): float {\n return this._fillOpacity;\n }\n\n /**\n *\n * @param opacity from 0 to 255\n */\n setOutlineOpacity(opacity: float): void {\n this._outlineOpacity = opacity;\n }\n\n /**\n *\n * @returns an opacity value from 0 to 255.\n */\n getOutlineOpacity(): float {\n return this._outlineOpacity;\n }\n\n setX(x: float): void {\n super.setX(x);\n this._transformationIsUpToDate = false;\n }\n\n setY(y: float): void {\n super.setY(y);\n this._transformationIsUpToDate = false;\n }\n\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._transformationIsUpToDate = false;\n }\n\n setWidth(width: float): void {\n if (this._width === width) {\n return;\n }\n this._scaleX = width / this._collisionTileMap.getWidth();\n this._width = width;\n this._transformationIsUpToDate = false;\n this.invalidateHitboxes();\n }\n\n setHeight(height: float): void {\n if (this._height === height) {\n return;\n }\n this._scaleY = height / this._collisionTileMap.getHeight();\n this._height = height;\n this._transformationIsUpToDate = false;\n this.invalidateHitboxes();\n }\n\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\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 = this.getScaleX();\n const scaleY = this.getScaleY();\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Change the scale on X and Y axis of the object.\n *\n * @param scale The new scale (must be greater than 0).\n */\n setScale(scale: float): void {\n this.setScaleX(scale);\n this.setScaleY(scale);\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param scaleX The new scale (must be greater than 0).\n */\n setScaleX(scaleX: float): void {\n if (scaleX < 0) {\n scaleX = 0;\n }\n if (this._scaleX === scaleX) {\n return;\n }\n this._scaleX = scaleX;\n this._width = scaleX * this._collisionTileMap.getWidth();\n this._transformationIsUpToDate = false;\n this.invalidateHitboxes();\n }\n\n /**\n * Change the scale on Y axis of the object (changing its width).\n *\n * @param scaleY The new scale (must be greater than 0).\n */\n setScaleY(scaleY: float): void {\n if (scaleY < 0) {\n scaleY = 0;\n }\n if (this._scaleY === scaleY) {\n return;\n }\n this._scaleY = scaleY;\n this._height = scaleY * this._collisionTileMap.getHeight();\n this._transformationIsUpToDate = false;\n this.invalidateHitboxes();\n }\n\n getWidth(): float {\n return this._width;\n }\n\n getHeight(): float {\n return this._height;\n }\n\n getScaleX(): float {\n return this._scaleX;\n }\n\n getScaleY(): float {\n return this._scaleY;\n }\n }\n gdjs.registerObject(\n 'TileMap::CollisionMask',\n gdjs.TileMapCollisionMaskRuntimeObject\n );\n TileMapCollisionMaskRuntimeObject.supportsReinitialization = false;\n}\n"],
5
- "mappings": "AACA,GAAU,MAAV,UAAU,EAAV,CAsCS,eACG,GAAK,aAC4B,CAoCzC,YAAY,EAAkD,EAAY,CACxE,MAAM,EAAmB,GAHnB,+BAAqC,GAI3C,KAAK,iBAAmB,EAAW,QAAQ,gBAC3C,KAAK,iBAAmB,EAAW,QAAQ,gBAC3C,KAAK,kBAAoB,EAAW,QAAQ,iBAC5C,KAAK,WAAa,EAAW,QAAQ,UACrC,KAAK,WAAa,EAAK,uBACrB,EAAW,QAAQ,WAErB,KAAK,cAAgB,EAAK,uBACxB,EAAW,QAAQ,cAErB,KAAK,aAAe,EAAW,QAAQ,YACvC,KAAK,gBAAkB,EAAW,QAAQ,eAC1C,KAAK,aAAe,EAAW,QAAQ,YACvC,KAAK,gBAAkB,EAAK,QAAQ,sBAAsB,WACxD,GAIF,KAAK,OAAS,EACd,KAAK,QAAU,EACf,KAAK,QAAU,EACf,KAAK,QAAU,EACf,KAAM,GAAkB,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K,UAAY,GAGrB,MAAK,QAAU,EAAS,KAAK,kBAAkB,YAC/C,KAAK,QAAU,EACf,KAAK,0BAA4B,GACjC,KAAK,sBAGP,QAAQ,EAAiB,EAAwB,CAC/C,KAAK,SAAS,GACd,KAAK,UAAU,GAQjB,UAAkB,CAChB,KAAM,GAAS,KAAK,YACd,EAAS,KAAK,YACpB,MAAO,KAAW,EAAS,EAAS,KAAK,KAAK,EAAS,GAQzD,SAAS,EAAoB,CAC3B,KAAK,UAAU,GACf,KAAK,UAAU,GAQjB,UAAU,EAAqB,CAI7B,AAHI,EAAS,GACX,GAAS,GAEP,KAAK,UAAY,GAGrB,MAAK,QAAU,EACf,KAAK,OAAS,EAAS,KAAK,kBAAkB,WAC9C,KAAK,0BAA4B,GACjC,KAAK,sBAQP,UAAU,EAAqB,CAI7B,AAHI,EAAS,GACX,GAAS,GAEP,KAAK,UAAY,GAGrB,MAAK,QAAU,EACf,KAAK,QAAU,EAAS,KAAK,kBAAkB,YAC/C,KAAK,0BAA4B,GACjC,KAAK,sBAGP,UAAkB,CAChB,MAAO,MAAK,OAGd,WAAmB,CACjB,MAAO,MAAK,QAGd,WAAmB,CACjB,MAAO,MAAK,QAGd,WAAmB,CACjB,MAAO,MAAK,SAjmBT,EAAM,oCAomBb,EAAK,eACH,yBACA,EAAK,mCAEP,EAAkC,yBAA2B,KA9oBrD",
4
+ "sourcesContent": ["/// <reference path=\"helper/TileMapHelper.d.ts\" />\nnamespace gdjs {\n export type TilemapCollisionMaskObjectDataType = {\n content: {\n tilemapJsonFile: string;\n tilesetJsonFile: string;\n collisionMaskTag: string;\n debugMode: boolean;\n fillColor: string;\n outlineColor: string;\n };\n fillOpacity: float;\n outlineOpacity: float;\n outlineSize: float;\n };\n\n export type TilemapCollisionMaskObjectData = ObjectData &\n TilemapCollisionMaskObjectDataType;\n\n export type TilemapCollisionMaskNetworkSyncDataType = {\n tmjf: string;\n tsjf: string;\n dm: boolean;\n oc: integer;\n fc: integer;\n os: float;\n fo: float;\n oo: float;\n wid: float;\n hei: float;\n };\n\n export type TilemapCollisionMaskNetworkSyncData = ObjectNetworkSyncData &\n TilemapCollisionMaskNetworkSyncDataType;\n\n /**\n * An object that handle hitboxes for a tile map.\n * @extends gdjs.RuntimeObject\n */\n export class TileMapCollisionMaskRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.Scalable {\n private _tilemapJsonFile: string;\n private _tilesetJsonFile: string;\n private _renderer: gdjs.TileMap.TileMapCollisionMaskRenderer;\n _collisionTileMap: gdjs.TileMap.TransformedCollisionTileMap;\n /**\n * The tiles are filtered according to this tag.\n *\n * This allows have multiple objects with different usage\n * for the same tile map.\n * For instance, platforms, jumpthru, ladder, spike, water...\n */\n private _collisionMaskTag: string;\n private _layerIndex: integer | null;\n private _tileMapManager: gdjs.TileMap.TileMapRuntimeManager;\n\n /**\n * When set to true, the hitboxes will be shown.\n */\n _debugMode: boolean;\n _fillColor: integer;\n _outlineColor: integer;\n _fillOpacity: float;\n _outlineOpacity: float;\n _outlineSize: float;\n\n _width: float;\n _height: float;\n _scaleX: float;\n _scaleY: float;\n\n /**\n * If the owner moves, the hitboxes vertices\n * will have to be transformed again.\n */\n private _transformationIsUpToDate: boolean = false;\n\n constructor(instanceContainer: gdjs.RuntimeInstanceContainer, objectData) {\n super(instanceContainer, objectData);\n this._tilemapJsonFile = objectData.content.tilemapJsonFile;\n this._tilesetJsonFile = objectData.content.tilesetJsonFile;\n this._collisionMaskTag = objectData.content.collisionMaskTag;\n this._layerIndex =\n objectData.content.useAllLayers ||\n objectData.content.useAllLayers === undefined\n ? null\n : Number.isFinite(objectData.content.layerIndex)\n ? objectData.content.layerIndex\n : 1;\n this._debugMode = objectData.content.debugMode;\n this._fillColor = gdjs.rgbOrHexStringToNumber(\n objectData.content.fillColor\n );\n this._outlineColor = gdjs.rgbOrHexStringToNumber(\n objectData.content.outlineColor\n );\n this._fillOpacity = objectData.content.fillOpacity;\n this._outlineOpacity = objectData.content.outlineOpacity;\n this._outlineSize = objectData.content.outlineSize;\n this._tileMapManager = gdjs.TileMap.TileMapRuntimeManager.getManager(\n instanceContainer\n );\n\n // The actual size is set when the tile map file is loaded.\n this._width = 0;\n this._height = 0;\n this._scaleX = 1;\n this._scaleY = 1;\n const editableTileMap = new TileMapHelper.EditableTileMap(\n 1,\n 1,\n 0,\n 0,\n new Map()\n );\n this._collisionTileMap = new gdjs.TileMap.TransformedCollisionTileMap(\n editableTileMap,\n this._collisionMaskTag,\n this._layerIndex\n );\n\n this._renderer = new gdjs.TileMap.TileMapCollisionMaskRenderer(\n this,\n instanceContainer\n );\n this._updateTileMap();\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n updatePreRender(instanceContainer: gdjs.RuntimeInstanceContainer) {\n super.updatePreRender(instanceContainer);\n\n if (this._debugMode && this.hitBoxesDirty) {\n this.updateHitBoxes();\n }\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n getVisibilityAABB() {\n return null;\n }\n\n updateFromObjectData(\n oldObjectData: TilemapCollisionMaskObjectData,\n newObjectData: TilemapCollisionMaskObjectData\n ): boolean {\n if (\n oldObjectData.content.tilemapJsonFile !==\n newObjectData.content.tilemapJsonFile\n ) {\n this.setTilemapJsonFile(newObjectData.content.tilemapJsonFile);\n }\n if (\n oldObjectData.content.tilesetJsonFile !==\n newObjectData.content.tilesetJsonFile\n ) {\n this.setTilesetJsonFile(newObjectData.content.tilesetJsonFile);\n }\n if (oldObjectData.content.debugMode !== newObjectData.content.debugMode) {\n this.setDebugMode(newObjectData.content.debugMode);\n }\n if (oldObjectData.content.fillColor !== newObjectData.content.fillColor) {\n this.setFillColor(\n gdjs.rgbOrHexStringToNumber(newObjectData.content.fillColor)\n );\n }\n if (\n oldObjectData.content.outlineColor !==\n newObjectData.content.outlineColor\n ) {\n this.setOutlineColor(\n gdjs.rgbOrHexStringToNumber(newObjectData.content.outlineColor)\n );\n }\n if (oldObjectData.fillOpacity !== newObjectData.fillOpacity) {\n this.setFillOpacity(newObjectData.fillOpacity);\n }\n if (oldObjectData.outlineOpacity !== newObjectData.outlineOpacity) {\n this.setOutlineOpacity(newObjectData.outlineOpacity);\n }\n if (oldObjectData.outlineSize !== newObjectData.outlineSize) {\n this.setOutlineSize(newObjectData.outlineSize);\n }\n // TODO Handle changes to collisionMaskTag, useAllLayers and layerIndex.\n return true;\n }\n\n getNetworkSyncData(): TilemapCollisionMaskNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n tmjf: this.getTilemapJsonFile(),\n tsjf: this.getTilesetJsonFile(),\n dm: this.getDebugMode(),\n oc: this.getOutlineColor(),\n fc: this.getFillColor(),\n os: this.getOutlineSize(),\n fo: this.getFillOpacity(),\n oo: this.getOutlineOpacity(),\n wid: this.getWidth(),\n hei: this.getHeight(),\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: TilemapCollisionMaskNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n if (networkSyncData.tmjf !== undefined) {\n this.setTilemapJsonFile(networkSyncData.tmjf);\n }\n if (networkSyncData.tsjf !== undefined) {\n this.setTilesetJsonFile(networkSyncData.tsjf);\n }\n if (networkSyncData.dm !== undefined) {\n this.setDebugMode(networkSyncData.dm);\n }\n if (networkSyncData.oc !== undefined) {\n this.setOutlineColor(networkSyncData.oc);\n }\n if (networkSyncData.fc !== undefined) {\n this.setFillColor(networkSyncData.fc);\n }\n if (networkSyncData.os !== undefined) {\n this.setOutlineSize(networkSyncData.os);\n }\n if (networkSyncData.fo !== undefined) {\n this.setFillOpacity(networkSyncData.fo);\n }\n if (networkSyncData.oo !== undefined) {\n this.setOutlineOpacity(networkSyncData.oo);\n }\n if (networkSyncData.wid !== undefined) {\n this.setWidth(networkSyncData.wid);\n }\n if (networkSyncData.hei !== undefined) {\n this.setHeight(networkSyncData.hei);\n }\n }\n\n extraInitializationFromInitialInstance(initialInstanceData): void {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n }\n\n private _updateTileMap(): void {\n this._tileMapManager.getOrLoadTileMap(\n this._tilemapJsonFile,\n this._tilesetJsonFile,\n 0, // levelIndex\n (tileMap: TileMapHelper.EditableTileMap | null) => {\n if (!tileMap) {\n // getOrLoadTileMap already log errors.\n return;\n }\n\n this._collisionTileMap = new gdjs.TileMap.TransformedCollisionTileMap(\n tileMap,\n this._collisionMaskTag,\n this._layerIndex\n );\n // The tile map polygons always keep the same references.\n // It works because the tilemap is never modified.\n this.hitBoxes = Array.from(\n this._collisionTileMap.getAllHitboxes(this._collisionMaskTag)\n );\n this._renderer.redrawCollisionMask();\n\n this._width = this._collisionTileMap.getWidth() * this._scaleX;\n this._height = this._collisionTileMap.getHeight() * this._scaleY;\n }\n );\n }\n\n updateHitBoxes(): void {\n this.updateTransformation();\n // Update the RuntimeObject hitboxes attribute.\n for (const _ of this._collisionTileMap.getAllHitboxes(\n this._collisionMaskTag\n )) {\n // RuntimeObject.hitBoxes contains the same polygons instances as the\n // hitboxes from the tiles.\n //\n // When hitboxes for a tile is asked to the model, they are updated\n // according to the new object location if needed.\n // Iterating over all the tiles forces them to update their hitboxes.\n //\n // The hitboxes array is built by _updateTileMap().\n }\n this.hitBoxesDirty = false;\n this._renderer.redrawCollisionMask();\n this.updateAABB();\n }\n\n /**\n * Update the affine transformation according to the object position, size\n * and angle.\n */\n updateTransformation(): void {\n if (this._transformationIsUpToDate) {\n return;\n }\n const transformation = this._collisionTileMap.getTransformation();\n\n const absScaleX = Math.abs(this._scaleX);\n const absScaleY = Math.abs(this._scaleY);\n\n transformation.setToIdentity();\n\n // Translation\n transformation.translate(this.x, this.y);\n\n // Rotation\n const angleInRadians = (this.angle * Math.PI) / 180;\n transformation.rotateAround(\n angleInRadians,\n this.getCenterX(),\n this.getCenterY()\n );\n\n // Scale\n transformation.scale(absScaleX, absScaleY);\n\n this._collisionTileMap.setTransformation(transformation);\n\n this._transformationIsUpToDate = true;\n }\n\n /**\n * This method is expensive and should not be called.\n * Prefer using {@link getHitBoxesAround} rather than getHitBoxes.\n */\n getHitBoxes(): gdjs.Polygon[] {\n if (this.hitBoxesDirty) {\n this.updateHitBoxes();\n this.updateAABB();\n this.hitBoxesDirty = false;\n }\n return this.hitBoxes;\n }\n\n getHitBoxesAround(left: float, top: float, right: float, bottom: float) {\n // This implementation doesn't call updateHitBoxes.\n // It's important for good performances because there is no need to\n // update the whole collision mask where only a few hitboxes must be\n // checked.\n this.updateTransformation();\n return this._collisionTileMap.getHitboxesAround(\n this._collisionMaskTag,\n left,\n top,\n right,\n bottom\n );\n }\n\n /**\n * insideObject usually use the AABB of the object.\n * But, in case of a tile map, it makes more sense to look each tile individually.\n * It returns true when there is an hitbox in the tile.\n */\n insideObject(x: float, y: float): boolean {\n this.updateTransformation();\n // This is more precise than the default implementation.\n return this._collisionTileMap.pointIsInsideTile(\n x,\n y,\n this._collisionMaskTag\n );\n }\n\n // This implementation doesn't use updateHitBoxes.\n // It's important for good performances.\n updateAABB(): void {\n if (this.getAngle() === 0) {\n // Fast computation of AABB for non rotated object\n this.aabb.min[0] = this.x;\n this.aabb.min[1] = this.y;\n this.aabb.max[0] = this.aabb.min[0] + this.getWidth();\n this.aabb.max[1] = this.aabb.min[1] + this.getHeight();\n } else {\n const affineTransformation = this._collisionTileMap.getTransformation();\n\n const left = 0;\n const right = this._collisionTileMap.getWidth();\n const top = 0;\n const bottom = this._collisionTileMap.getHeight();\n\n const workingPoint = this.aabb.min;\n\n workingPoint[0] = left;\n workingPoint[1] = top;\n affineTransformation.transform(workingPoint, workingPoint);\n const topLeftX = workingPoint[0];\n const topLeftY = workingPoint[1];\n\n workingPoint[0] = right;\n workingPoint[1] = top;\n affineTransformation.transform(workingPoint, workingPoint);\n const topRightX = workingPoint[0];\n const topRightY = workingPoint[1];\n\n workingPoint[0] = right;\n workingPoint[1] = bottom;\n affineTransformation.transform(workingPoint, workingPoint);\n const bottomRightX = workingPoint[0];\n const bottomRightY = workingPoint[1];\n\n workingPoint[0] = left;\n workingPoint[1] = bottom;\n affineTransformation.transform(workingPoint, workingPoint);\n const bottomLeftX = workingPoint[0];\n const bottomLeftY = workingPoint[1];\n\n this.aabb.min[0] = Math.min(\n topLeftX,\n topRightX,\n bottomRightX,\n bottomLeftX\n );\n this.aabb.max[0] = Math.max(\n topLeftX,\n topRightX,\n bottomRightX,\n bottomLeftX\n );\n this.aabb.min[1] = Math.min(\n topLeftY,\n topRightY,\n bottomRightY,\n bottomLeftY\n );\n this.aabb.max[1] = Math.max(\n topLeftY,\n topRightY,\n bottomRightY,\n bottomLeftY\n );\n }\n }\n\n /**\n * Set the Tilemap json file to display.\n */\n setTilemapJsonFile(tilemapJsonFile: string): void {\n this._tilemapJsonFile = tilemapJsonFile;\n this._updateTileMap();\n }\n\n getTilemapJsonFile(): string {\n return this._tilemapJsonFile;\n }\n\n isTilemapJsonFile(selectedTilemapJsonFile: string): boolean {\n return this._tilemapJsonFile === selectedTilemapJsonFile;\n }\n\n setTilesetJsonFile(tilesetJsonFile: string) {\n this._tilesetJsonFile = tilesetJsonFile;\n this._updateTileMap();\n }\n\n getTilesetJsonFile(): string {\n return this._tilesetJsonFile;\n }\n\n isTilesetJsonFile(selectedTilesetJsonFile: string): boolean {\n return this._tilesetJsonFile === selectedTilesetJsonFile;\n }\n\n /**\n * @returns true if the hitboxes are shown.\n */\n getDebugMode(): boolean {\n return this._debugMode;\n }\n\n /**\n * @returns true if the hitboxes are shown.\n */\n setDebugMode(debugMode: boolean): void {\n this._debugMode = debugMode;\n this._renderer.redrawCollisionMask();\n }\n\n getFillColor(): integer {\n return this._fillColor;\n }\n\n getOutlineColor(): integer {\n return this._outlineColor;\n }\n\n setFillColor(fillColor: integer): void {\n this._fillColor = fillColor;\n }\n\n setOutlineColor(outlineColor: integer): void {\n this._outlineColor = outlineColor;\n }\n\n setOutlineSize(size: float): void {\n this._outlineSize = size;\n }\n\n getOutlineSize(): float {\n return this._outlineSize;\n }\n\n /**\n *\n * @param opacity from 0 to 255\n */\n setFillOpacity(opacity: float): void {\n this._fillOpacity = opacity;\n }\n\n /**\n *\n * @returns an opacity value from 0 to 255.\n */\n getFillOpacity(): float {\n return this._fillOpacity;\n }\n\n /**\n *\n * @param opacity from 0 to 255\n */\n setOutlineOpacity(opacity: float): void {\n this._outlineOpacity = opacity;\n }\n\n /**\n *\n * @returns an opacity value from 0 to 255.\n */\n getOutlineOpacity(): float {\n return this._outlineOpacity;\n }\n\n setX(x: float): void {\n super.setX(x);\n this._transformationIsUpToDate = false;\n }\n\n setY(y: float): void {\n super.setY(y);\n this._transformationIsUpToDate = false;\n }\n\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._transformationIsUpToDate = false;\n }\n\n setWidth(width: float): void {\n if (this._width === width) {\n return;\n }\n this._scaleX = width / this._collisionTileMap.getWidth();\n this._width = width;\n this._transformationIsUpToDate = false;\n this.invalidateHitboxes();\n }\n\n setHeight(height: float): void {\n if (this._height === height) {\n return;\n }\n this._scaleY = height / this._collisionTileMap.getHeight();\n this._height = height;\n this._transformationIsUpToDate = false;\n this.invalidateHitboxes();\n }\n\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\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 = this.getScaleX();\n const scaleY = this.getScaleY();\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Change the scale on X and Y axis of the object.\n *\n * @param scale The new scale (must be greater than 0).\n */\n setScale(scale: float): void {\n this.setScaleX(scale);\n this.setScaleY(scale);\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param scaleX The new scale (must be greater than 0).\n */\n setScaleX(scaleX: float): void {\n if (scaleX < 0) {\n scaleX = 0;\n }\n if (this._scaleX === scaleX) {\n return;\n }\n this._scaleX = scaleX;\n this._width = scaleX * this._collisionTileMap.getWidth();\n this._transformationIsUpToDate = false;\n this.invalidateHitboxes();\n }\n\n /**\n * Change the scale on Y axis of the object (changing its width).\n *\n * @param scaleY The new scale (must be greater than 0).\n */\n setScaleY(scaleY: float): void {\n if (scaleY < 0) {\n scaleY = 0;\n }\n if (this._scaleY === scaleY) {\n return;\n }\n this._scaleY = scaleY;\n this._height = scaleY * this._collisionTileMap.getHeight();\n this._transformationIsUpToDate = false;\n this.invalidateHitboxes();\n }\n\n getWidth(): float {\n return this._width;\n }\n\n getHeight(): float {\n return this._height;\n }\n\n getScaleX(): float {\n return this._scaleX;\n }\n\n getScaleY(): float {\n return this._scaleY;\n }\n }\n gdjs.registerObject(\n 'TileMap::CollisionMask',\n gdjs.TileMapCollisionMaskRuntimeObject\n );\n TileMapCollisionMaskRuntimeObject.supportsReinitialization = false;\n}\n"],
5
+ "mappings": "AACA,GAAU,MAAV,UAAU,EAAV,CAsCS,eACG,GAAK,aAC4B,CAqCzC,YAAY,EAAkD,EAAY,CACxE,MAAM,EAAmB,GAHnB,+BAAqC,GAI3C,KAAK,iBAAmB,EAAW,QAAQ,gBAC3C,KAAK,iBAAmB,EAAW,QAAQ,gBAC3C,KAAK,kBAAoB,EAAW,QAAQ,iBAC5C,KAAK,YACH,EAAW,QAAQ,cACnB,EAAW,QAAQ,eAAiB,OAChC,KACA,OAAO,SAAS,EAAW,QAAQ,YACnC,EAAW,QAAQ,WACnB,EACN,KAAK,WAAa,EAAW,QAAQ,UACrC,KAAK,WAAa,EAAK,uBACrB,EAAW,QAAQ,WAErB,KAAK,cAAgB,EAAK,uBACxB,EAAW,QAAQ,cAErB,KAAK,aAAe,EAAW,QAAQ,YACvC,KAAK,gBAAkB,EAAW,QAAQ,eAC1C,KAAK,aAAe,EAAW,QAAQ,YACvC,KAAK,gBAAkB,EAAK,QAAQ,sBAAsB,WACxD,GAIF,KAAK,OAAS,EACd,KAAK,QAAU,EACf,KAAK,QAAU,EACf,KAAK,QAAU,E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,sBAGP,UAAU,EAAqB,CAC7B,AAAI,KAAK,UAAY,GAGrB,MAAK,QAAU,EAAS,KAAK,kBAAkB,YAC/C,KAAK,QAAU,EACf,KAAK,0BAA4B,GACjC,KAAK,sBAGP,QAAQ,EAAiB,EAAwB,CAC/C,KAAK,SAAS,GACd,KAAK,UAAU,GAQjB,UAAkB,CAChB,KAAM,GAAS,KAAK,YACd,EAAS,KAAK,YACpB,MAAO,KAAW,EAAS,EAAS,KAAK,KAAK,EAAS,GAQzD,SAAS,EAAoB,CAC3B,KAAK,UAAU,GACf,KAAK,UAAU,GAQjB,UAAU,EAAqB,CAI7B,AAHI,EAAS,GACX,GAAS,GAEP,KAAK,UAAY,GAGrB,MAAK,QAAU,EACf,KAAK,OAAS,EAAS,KAAK,kBAAkB,WAC9C,KAAK,0BAA4B,GACjC,KAAK,sBAQP,UAAU,EAAqB,CAI7B,AAHI,EAAS,GACX,GAAS,GAEP,KAAK,UAAY,GAGrB,MAAK,QAAU,EACf,KAAK,QAAU,EAAS,KAAK,kBAAkB,YAC/C,KAAK,0BAA4B,GACjC,KAAK,sBAGP,UAAkB,CAChB,MAAO,MAAK,OAGd,WAAmB,CACjB,MAAO,MAAK,QAGd,WAAmB,CACjB,MAAO,MAAK,QAGd,WAAmB,CACjB,MAAO,MAAK,SA5mBT,EAAM,oCA+mBb,EAAK,eACH,yBACA,EAAK,mCAEP,EAAkC,yBAA2B,KAzpBrD",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(t){class l extends t.RuntimeObject{constructor(e,i){super(e,i);this._frameElapsedTime=0;this._opacity=i.content.opacity,this._tilemapJsonFile=i.content.tilemapJsonFile,this._tilesetJsonFile=i.content.tilesetJsonFile,this._tilemapAtlasImage=i.content.tilemapAtlasImage,this._displayMode=i.content.displayMode,this._layerIndex=i.content.layerIndex,this._levelIndex=i.content.levelIndex,this._animationSpeedScale=i.content.animationSpeedScale,this._animationFps=i.content.animationFps,this._tileMapManager=t.TileMap.TileMapRuntimeManager.getManager(e),this._renderer=new t.TileMapRuntimeObjectRenderer(this,e),this._updateTileMap(),this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}update(e){if(this._animationSpeedScale<=0||this._animationFps===0)return;const i=this.getElapsedTime()/1e3;for(this._frameElapsedTime+=i*this._animationSpeedScale;this._frameElapsedTime>1/this._animationFps;)this._renderer.incrementAnimationFrameX(e),this._frameElapsedTime-=1/this._animationFps}updateFromObjectData(e,i){return e.content.opacity!==i.content.opacity&&this.setOpacity(i.content.opacity),e.content.tilemapJsonFile!==i.content.tilemapJsonFile&&this.setTilemapJsonFile(i.content.tilemapJsonFile),e.content.tilesetJsonFile!==i.content.tilesetJsonFile&&this.setTilesetJsonFile(i.content.tilesetJsonFile),e.content.displayMode!==i.content.displayMode&&this.setDisplayMode(i.content.displayMode),e.content.layerIndex!==i.content.layerIndex&&this.setLayerIndex(i.content.layerIndex),e.content.levelIndex!==i.content.levelIndex&&this.setLevelIndex(i.content.levelIndex),e.content.animationSpeedScale!==i.content.animationSpeedScale&&this.setAnimationSpeedScale(i.content.animationSpeedScale),e.content.animationFps!==i.content.animationFps&&this.setAnimationFps(i.content.animationFps),e.content.tilemapAtlasImage===i.content.tilemapAtlasImage}getNetworkSyncData(){return{...super.getNetworkSyncData(),op:this._opacity,tmjf:this._tilemapJsonFile,tsjf:this._tilesetJsonFile,tmai:this._tilemapAtlasImage,dm:this._displayMode,lai:this._layerIndex,lei:this._levelIndex,asps:this._animationSpeedScale,wid:this.getWidth(),hei:this.getHeight()}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),e.op!==void 0&&this.setOpacity(e.op),e.tmjf!==void 0&&this.setTilemapJsonFile(e.tmjf),e.tsjf!==void 0&&this.setTilesetJsonFile(e.tsjf),e.tmai!==void 0&&(this._tilemapAtlasImage=e.tmai),e.dm!==void 0&&this.setDisplayMode(e.dm),e.lai!==void 0&&this.setLayerIndex(e.lai),e.lei!==void 0&&this.setLevelIndex(e.lei),e.asps!==void 0&&this.setAnimationSpeedScale(e.asps),e.wid!==void 0&&this.setWidth(e.wid),e.hei!==void 0&&this.setHeight(e.hei)}extraInitializationFromInitialInstance(e){e.customSize&&(this.setWidth(e.width),this.setHeight(e.height))}_updateTileMap(){this._tileMapManager.getOrLoadTileMap(this._tilemapJsonFile,this._tilesetJsonFile,this._levelIndex,e=>{!e||this._tileMapManager.getOrLoadTextureCache(i=>{const s=this.getInstanceContainer().getGame(),n=s.resolveEmbeddedResource(this._tilemapJsonFile,i);return s.getImageManager().getPIXITexture(n)},this._tilemapAtlasImage,this._tilemapJsonFile,this._tilesetJsonFile,this._levelIndex,i=>{!i||this._renderer.updatePixiTileMap(e,i)})})}onDestroyed(){super.onDestroyed(),this._renderer.destroy()}setTilemapJsonFile(e){this._tilemapJsonFile=e,this._updateTileMap()}getTilemapJsonFile(){return this._tilemapJsonFile}isTilemapJsonFile(e){return this._tilemapJsonFile===e}setTilesetJsonFile(e){this._tilesetJsonFile=e,this._updateTileMap()}getTilesetJsonFile(){return this._tilesetJsonFile}setAnimationFps(e){this._animationFps=e}getAnimationFps(){return this._animationFps}isTilesetJsonFile(e){return this._tilesetJsonFile===e}isDisplayMode(e){return this._displayMode===e}setDisplayMode(e){this._displayMode=e,this._updateTileMap()}getDisplayMode(){return this._displayMode}setLayerIndex(e){this._layerIndex=e,this._updateTileMap()}getLayerIndex(){return this._layerIndex}setLevelIndex(e){this._levelIndex=e,this._updateTileMap()}getLevelIndex(){return this._levelIndex}setAnimationSpeedScale(e){this._animationSpeedScale=e}getAnimationSpeedScale(){return this._animationSpeedScale}setWidth(e){this.getWidth()!==e&&(this._renderer.setWidth(e),this.invalidateHitboxes())}setHeight(e){this.getHeight()!==e&&(this._renderer.setHeight(e),this.invalidateHitboxes())}setSize(e,i){this.setWidth(e),this.setHeight(i)}getScale(){const e=this.getScaleX(),i=this.getScaleY();return e===i?e:Math.sqrt(e*i)}setScale(e){this.setScaleX(e),this.setScaleY(e)}setScaleX(e){e<0&&(e=0),this.getScaleX()!==e&&(this._renderer.setScaleX(e),this.invalidateHitboxes())}setScaleY(e){e<0&&(e=0),this.getScaleY()!==e&&(this._renderer.setScaleY(e),this.invalidateHitboxes())}setX(e){super.setX(e),this._renderer.updatePosition()}setY(e){super.setY(e),this._renderer.updatePosition()}setAngle(e){super.setAngle(e),this._renderer.updateAngle()}setOpacity(e){this._opacity=e,this._renderer.updateOpacity()}getOpacity(){return this._opacity}getWidth(){return this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}getScaleX(){return this._renderer.getScaleX()}getScaleY(){return this._renderer.getScaleY()}}t.TileMapRuntimeObject=l,t.registerObject("TileMap::TileMap",t.TileMapRuntimeObject)})(gdjs||(gdjs={}));
1
+ var gdjs;(function(t){class l extends t.RuntimeObject{constructor(e,i){super(e,i);this._frameElapsedTime=0;this._opacity=i.content.opacity,this._tilemapJsonFile=i.content.tilemapJsonFile,this._tilesetJsonFile=i.content.tilesetJsonFile,this._tilemapAtlasImage=i.content.tilemapAtlasImage,this._displayMode=i.content.displayMode,this._layerIndex=i.content.layerIndex,this._levelIndex=i.content.levelIndex,this._animationSpeedScale=i.content.animationSpeedScale,this._animationFps=i.content.animationFps,this._tileMapManager=t.TileMap.TileMapRuntimeManager.getManager(e),this._renderer=new t.TileMapRuntimeObjectRenderer(this,e),this._updateTileMap(),this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}update(e){if(this._animationSpeedScale<=0||this._animationFps===0)return;const i=this.getElapsedTime()/1e3;for(this._frameElapsedTime+=i*this._animationSpeedScale;this._frameElapsedTime>1/this._animationFps;)this._renderer.incrementAnimationFrameX(e),this._frameElapsedTime-=1/this._animationFps}updateFromObjectData(e,i){return e.content.opacity!==i.content.opacity&&this.setOpacity(i.content.opacity),e.content.tilemapJsonFile!==i.content.tilemapJsonFile&&this.setTilemapJsonFile(i.content.tilemapJsonFile),e.content.tilesetJsonFile!==i.content.tilesetJsonFile&&this.setTilesetJsonFile(i.content.tilesetJsonFile),e.content.displayMode!==i.content.displayMode&&this.setDisplayMode(i.content.displayMode),e.content.layerIndex!==i.content.layerIndex&&this.setLayerIndex(i.content.layerIndex),e.content.levelIndex!==i.content.levelIndex&&this.setLevelIndex(i.content.levelIndex),e.content.animationSpeedScale!==i.content.animationSpeedScale&&this.setAnimationSpeedScale(i.content.animationSpeedScale),e.content.animationFps!==i.content.animationFps&&this.setAnimationFps(i.content.animationFps),e.content.tilemapAtlasImage===i.content.tilemapAtlasImage}getNetworkSyncData(){return{...super.getNetworkSyncData(),op:this._opacity,tmjf:this._tilemapJsonFile,tsjf:this._tilesetJsonFile,tmai:this._tilemapAtlasImage,dm:this._displayMode,lai:this._layerIndex,lei:this._levelIndex,asps:this._animationSpeedScale,wid:this.getWidth(),hei:this.getHeight()}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),e.op!==void 0&&this.setOpacity(e.op),e.tmjf!==void 0&&this.setTilemapJsonFile(e.tmjf),e.tsjf!==void 0&&this.setTilesetJsonFile(e.tsjf),e.tmai!==void 0&&(this._tilemapAtlasImage=e.tmai),e.dm!==void 0&&this.setDisplayMode(e.dm),e.lai!==void 0&&this.setLayerIndex(e.lai),e.lei!==void 0&&this.setLevelIndex(e.lei),e.asps!==void 0&&this.setAnimationSpeedScale(e.asps),e.wid!==void 0&&this.setWidth(e.wid),e.hei!==void 0&&this.setHeight(e.hei)}extraInitializationFromInitialInstance(e){e.customSize&&(this.setWidth(e.width),this.setHeight(e.height)),e.opacity!==void 0&&this.setOpacity(e.opacity)}_updateTileMap(){this._tileMapManager.getOrLoadTileMap(this._tilemapJsonFile,this._tilesetJsonFile,this._levelIndex,e=>{!e||this._tileMapManager.getOrLoadTextureCache(i=>{const s=this.getInstanceContainer().getGame(),n=s.resolveEmbeddedResource(this._tilemapJsonFile,i);return s.getImageManager().getPIXITexture(n)},this._tilemapAtlasImage,this._tilemapJsonFile,this._tilesetJsonFile,this._levelIndex,i=>{!i||this._renderer.updatePixiTileMap(e,i)})})}onDestroyed(){super.onDestroyed(),this._renderer.destroy()}setTilemapJsonFile(e){this._tilemapJsonFile=e,this._updateTileMap()}getTilemapJsonFile(){return this._tilemapJsonFile}isTilemapJsonFile(e){return this._tilemapJsonFile===e}setTilesetJsonFile(e){this._tilesetJsonFile=e,this._updateTileMap()}getTilesetJsonFile(){return this._tilesetJsonFile}setAnimationFps(e){this._animationFps=e}getAnimationFps(){return this._animationFps}isTilesetJsonFile(e){return this._tilesetJsonFile===e}isDisplayMode(e){return this._displayMode===e}setDisplayMode(e){this._displayMode=e,this._updateTileMap()}getDisplayMode(){return this._displayMode}setLayerIndex(e){this._layerIndex=e,this._updateTileMap()}getLayerIndex(){return this._layerIndex}setLevelIndex(e){this._levelIndex=e,this._updateTileMap()}getLevelIndex(){return this._levelIndex}setAnimationSpeedScale(e){this._animationSpeedScale=e}getAnimationSpeedScale(){return this._animationSpeedScale}setWidth(e){this.getWidth()!==e&&(this._renderer.setWidth(e),this.invalidateHitboxes())}setHeight(e){this.getHeight()!==e&&(this._renderer.setHeight(e),this.invalidateHitboxes())}setSize(e,i){this.setWidth(e),this.setHeight(i)}getScale(){const e=this.getScaleX(),i=this.getScaleY();return e===i?e:Math.sqrt(e*i)}setScale(e){this.setScaleX(e),this.setScaleY(e)}setScaleX(e){e<0&&(e=0),this.getScaleX()!==e&&(this._renderer.setScaleX(e),this.invalidateHitboxes())}setScaleY(e){e<0&&(e=0),this.getScaleY()!==e&&(this._renderer.setScaleY(e),this.invalidateHitboxes())}setX(e){super.setX(e),this._renderer.updatePosition()}setY(e){super.setY(e),this._renderer.updatePosition()}setAngle(e){super.setAngle(e),this._renderer.updateAngle()}setOpacity(e){this._opacity=e,this._renderer.updateOpacity()}getOpacity(){return this._opacity}getWidth(){return this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}getScaleX(){return this._renderer.getScaleX()}getScaleY(){return this._renderer.getScaleY()}}t.TileMapRuntimeObject=l,t.registerObject("TileMap::TileMap",t.TileMapRuntimeObject)})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=tilemapruntimeobject.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/TileMap/tilemapruntimeobject.ts"],
4
- "sourcesContent": ["/// <reference path=\"helper/TileMapHelper.d.ts\" />\nnamespace gdjs {\n export type TilemapObjectDataType = {\n content: {\n opacity: number;\n tilemapJsonFile: string;\n tilesetJsonFile: string;\n tilemapAtlasImage: string;\n displayMode: string;\n layerIndex: integer;\n levelIndex: integer;\n animationSpeedScale: number;\n animationFps: number;\n };\n };\n\n export type TilemapObjectData = ObjectData & TilemapObjectDataType;\n\n export type TilemapNetworkSyncDataType = {\n op: number;\n tmjf: string;\n tsjf: string;\n tmai: string;\n dm: string;\n lai: number;\n lei: number;\n asps: number;\n wid: number;\n hei: number;\n };\n\n export type TilemapNetworkSyncData = ObjectNetworkSyncData &\n TilemapNetworkSyncDataType;\n\n /**\n * Displays a Tilemap object (LDtk and Tiled).\n */\n export class TileMapRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.Scalable, gdjs.OpacityHandler {\n _frameElapsedTime: float = 0;\n _opacity: float;\n _tilemapJsonFile: string;\n _tilesetJsonFile: string;\n _tilemapAtlasImage: string;\n _displayMode: string;\n _layerIndex: integer;\n _levelIndex: integer;\n _animationSpeedScale: number;\n _animationFps: number;\n _tileMapManager: gdjs.TileMap.TileMapRuntimeManager;\n _renderer: gdjs.TileMapRuntimeObjectPixiRenderer;\n\n constructor(instanceContainer: gdjs.RuntimeInstanceContainer, objectData) {\n super(instanceContainer, objectData);\n this._opacity = objectData.content.opacity;\n this._tilemapJsonFile = objectData.content.tilemapJsonFile;\n this._tilesetJsonFile = objectData.content.tilesetJsonFile;\n this._tilemapAtlasImage = objectData.content.tilemapAtlasImage;\n this._displayMode = objectData.content.displayMode;\n this._layerIndex = objectData.content.layerIndex;\n this._levelIndex = objectData.content.levelIndex;\n this._animationSpeedScale = objectData.content.animationSpeedScale;\n this._animationFps = objectData.content.animationFps;\n this._tileMapManager = gdjs.TileMap.TileMapRuntimeManager.getManager(\n instanceContainer\n );\n this._renderer = new gdjs.TileMapRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n this._updateTileMap();\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n if (this._animationSpeedScale <= 0 || this._animationFps === 0) {\n return;\n }\n const elapsedTime = this.getElapsedTime() / 1000;\n this._frameElapsedTime += elapsedTime * this._animationSpeedScale;\n while (this._frameElapsedTime > 1 / this._animationFps) {\n this._renderer.incrementAnimationFrameX(instanceContainer);\n this._frameElapsedTime -= 1 / this._animationFps;\n }\n }\n\n updateFromObjectData(\n oldObjectData: TilemapObjectData,\n newObjectData: TilemapObjectData\n ): boolean {\n if (oldObjectData.content.opacity !== newObjectData.content.opacity) {\n this.setOpacity(newObjectData.content.opacity);\n }\n if (\n oldObjectData.content.tilemapJsonFile !==\n newObjectData.content.tilemapJsonFile\n ) {\n this.setTilemapJsonFile(newObjectData.content.tilemapJsonFile);\n }\n if (\n oldObjectData.content.tilesetJsonFile !==\n newObjectData.content.tilesetJsonFile\n ) {\n this.setTilesetJsonFile(newObjectData.content.tilesetJsonFile);\n }\n if (\n oldObjectData.content.displayMode !== newObjectData.content.displayMode\n ) {\n this.setDisplayMode(newObjectData.content.displayMode);\n }\n if (\n oldObjectData.content.layerIndex !== newObjectData.content.layerIndex\n ) {\n this.setLayerIndex(newObjectData.content.layerIndex);\n }\n if (\n oldObjectData.content.levelIndex !== newObjectData.content.levelIndex\n ) {\n this.setLevelIndex(newObjectData.content.levelIndex);\n }\n if (\n oldObjectData.content.animationSpeedScale !==\n newObjectData.content.animationSpeedScale\n ) {\n this.setAnimationSpeedScale(newObjectData.content.animationSpeedScale);\n }\n if (\n oldObjectData.content.animationFps !==\n newObjectData.content.animationFps\n ) {\n this.setAnimationFps(newObjectData.content.animationFps);\n }\n if (\n oldObjectData.content.tilemapAtlasImage !==\n newObjectData.content.tilemapAtlasImage\n ) {\n // TODO: support changing the atlas texture\n return false;\n }\n return true;\n }\n\n getNetworkSyncData(): TilemapNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n op: this._opacity,\n tmjf: this._tilemapJsonFile,\n tsjf: this._tilesetJsonFile,\n tmai: this._tilemapAtlasImage,\n dm: this._displayMode,\n lai: this._layerIndex,\n lei: this._levelIndex,\n asps: this._animationSpeedScale,\n wid: this.getWidth(),\n hei: this.getHeight(),\n };\n }\n\n updateFromNetworkSyncData(networkSyncData: TilemapNetworkSyncData): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n if (networkSyncData.op !== undefined) {\n this.setOpacity(networkSyncData.op);\n }\n if (networkSyncData.tmjf !== undefined) {\n this.setTilemapJsonFile(networkSyncData.tmjf);\n }\n if (networkSyncData.tsjf !== undefined) {\n this.setTilesetJsonFile(networkSyncData.tsjf);\n }\n if (networkSyncData.tmai !== undefined) {\n this._tilemapAtlasImage = networkSyncData.tmai;\n }\n if (networkSyncData.dm !== undefined) {\n this.setDisplayMode(networkSyncData.dm);\n }\n if (networkSyncData.lai !== undefined) {\n this.setLayerIndex(networkSyncData.lai);\n }\n if (networkSyncData.lei !== undefined) {\n this.setLevelIndex(networkSyncData.lei);\n }\n if (networkSyncData.asps !== undefined) {\n this.setAnimationSpeedScale(networkSyncData.asps);\n }\n if (networkSyncData.wid !== undefined) {\n this.setWidth(networkSyncData.wid);\n }\n if (networkSyncData.hei !== undefined) {\n this.setHeight(networkSyncData.hei);\n }\n }\n\n extraInitializationFromInitialInstance(initialInstanceData): void {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n }\n\n private _updateTileMap(): void {\n this._tileMapManager.getOrLoadTileMap(\n this._tilemapJsonFile,\n this._tilesetJsonFile,\n this._levelIndex,\n (tileMap: TileMapHelper.EditableTileMap | null) => {\n if (!tileMap) {\n // getOrLoadTileMap already warn.\n return;\n }\n this._tileMapManager.getOrLoadTextureCache(\n (textureName) => {\n const game = this.getInstanceContainer().getGame();\n const mappedName = game.resolveEmbeddedResource(\n this._tilemapJsonFile,\n textureName\n );\n return (game\n .getImageManager()\n .getPIXITexture(mappedName) as unknown) as PIXI.BaseTexture<\n PIXI.Resource\n >;\n },\n this._tilemapAtlasImage,\n this._tilemapJsonFile,\n this._tilesetJsonFile,\n this._levelIndex,\n (textureCache: TileMapHelper.TileTextureCache | null) => {\n if (!textureCache) {\n // getOrLoadTextureCache already log warns and errors.\n return;\n }\n this._renderer.updatePixiTileMap(tileMap, textureCache);\n }\n );\n }\n );\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n /**\n * Set the Tilemap file to display.\n */\n setTilemapJsonFile(tilemapJsonFile: string): void {\n this._tilemapJsonFile = tilemapJsonFile;\n this._updateTileMap();\n }\n\n getTilemapJsonFile(): string {\n return this._tilemapJsonFile;\n }\n\n isTilemapJsonFile(selectedTilemapJsonFile: string): boolean {\n return this._tilemapJsonFile === selectedTilemapJsonFile;\n }\n\n setTilesetJsonFile(tilesetJsonFile: string): void {\n this._tilesetJsonFile = tilesetJsonFile;\n this._updateTileMap();\n }\n\n getTilesetJsonFile(): string {\n return this._tilesetJsonFile;\n }\n\n setAnimationFps(animationFps: float) {\n this._animationFps = animationFps;\n }\n\n getAnimationFps(): float {\n return this._animationFps;\n }\n\n isTilesetJsonFile(selectedTilesetJsonFile: string): boolean {\n return this._tilesetJsonFile === selectedTilesetJsonFile;\n }\n\n isDisplayMode(selectedDisplayMode: string): boolean {\n return this._displayMode === selectedDisplayMode;\n }\n\n setDisplayMode(displayMode: string): void {\n this._displayMode = displayMode;\n this._updateTileMap();\n }\n\n getDisplayMode(): string {\n return this._displayMode;\n }\n\n setLayerIndex(layerIndex): void {\n this._layerIndex = layerIndex;\n this._updateTileMap();\n }\n\n getLayerIndex(): integer {\n return this._layerIndex;\n }\n\n setLevelIndex(levelIndex): void {\n this._levelIndex = levelIndex;\n this._updateTileMap();\n }\n\n getLevelIndex() {\n return this._levelIndex;\n }\n\n setAnimationSpeedScale(animationSpeedScale): void {\n this._animationSpeedScale = animationSpeedScale;\n }\n\n getAnimationSpeedScale(): float {\n return this._animationSpeedScale;\n }\n\n setWidth(width: float): void {\n if (this.getWidth() === width) return;\n\n this._renderer.setWidth(width);\n this.invalidateHitboxes();\n }\n\n setHeight(height: float): void {\n if (this.getHeight() === height) return;\n\n this._renderer.setHeight(height);\n this.invalidateHitboxes();\n }\n\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\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 = this.getScaleX();\n const scaleY = this.getScaleY();\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Change the scale on X and Y axis of the object.\n *\n * @param scale The new scale (must be greater than 0).\n */\n setScale(scale: float): void {\n this.setScaleX(scale);\n this.setScaleY(scale);\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param scaleX The new scale (must be greater than 0).\n */\n setScaleX(scaleX: float): void {\n if (scaleX < 0) {\n scaleX = 0;\n }\n if (this.getScaleX() === scaleX) return;\n\n this._renderer.setScaleX(scaleX);\n this.invalidateHitboxes();\n }\n\n /**\n * Change the scale on Y axis of the object (changing its width).\n *\n * @param scaleY The new scale (must be greater than 0).\n */\n setScaleY(scaleY: float): void {\n if (scaleY < 0) {\n scaleY = 0;\n }\n if (this.getScaleY() === scaleY) return;\n\n this._renderer.setScaleY(scaleY);\n this.invalidateHitboxes();\n }\n\n setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n setOpacity(opacity: float): void {\n this._opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n getOpacity(): float {\n return this._opacity;\n }\n\n getWidth(): float {\n return this._renderer.getWidth();\n }\n\n getHeight(): float {\n return this._renderer.getHeight();\n }\n\n getScaleX(): float {\n return this._renderer.getScaleX();\n }\n\n getScaleY(): float {\n return this._renderer.getScaleY();\n }\n }\n gdjs.registerObject('TileMap::TileMap', gdjs.TileMapRuntimeObject);\n}\n"],
5
- "mappings": "AACA,GAAU,MAAV,UAAU,EAAV,CAoCS,eACG,GAAK,aACiD,CAc9D,YAAY,EAAkD,EAAY,CACxE,MAAM,EAAmB,GAd3B,uBAA2B,EAezB,KAAK,SAAW,EAAW,QAAQ,QACnC,KAAK,iBAAmB,EAAW,QAAQ,gBAC3C,KAAK,iBAAmB,EAAW,QAAQ,gBAC3C,KAAK,mBAAqB,EAAW,QAAQ,kBAC7C,KAAK,aAAe,EAAW,QAAQ,YACvC,KAAK,YAAc,EAAW,QAAQ,WACtC,KAAK,YAAc,EAAW,QAAQ,WACtC,KAAK,qBAAuB,EAAW,QAAQ,oBAC/C,KAAK,cAAgB,EAAW,QAAQ,aACxC,KAAK,gBAAkB,EAAK,QAAQ,sBAAsB,WACxD,GAEF,KAAK,UAAY,GAAI,GAAK,6BACxB,KACA,GAEF,KAAK,iBAGL,KAAK,YAGP,mBAAoB,CAClB,MAAO,MAAK,UAAU,oBAGxB,OAAO,EAAwD,CAC7D,GAAI,KAAK,sBAAwB,GAAK,KAAK,gBAAkB,EAC3D,OAEF,KAAM,GAAc,KAAK,iBAAmB,IAE5C,IADA,KAAK,mBAAqB,EAAc,KAAK,qBACtC,KAAK,kBAAoB,EAAI,KAAK,eACvC,KAAK,UAAU,yBAAyB,GACxC,KAAK,mBAAqB,EAAI,KAAK,cAIvC,qBACE,EACA,EACS,CA2CT,MA1CI,GAAc,QAAQ,UAAY,EAAc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.ts\" />\nnamespace gdjs {\n export type TilemapObjectDataType = {\n content: {\n opacity: number;\n tilemapJsonFile: string;\n tilesetJsonFile: string;\n tilemapAtlasImage: string;\n displayMode: string;\n layerIndex: integer;\n levelIndex: integer;\n animationSpeedScale: number;\n animationFps: number;\n };\n };\n\n export type TilemapObjectData = ObjectData & TilemapObjectDataType;\n\n export type TilemapNetworkSyncDataType = {\n op: number;\n tmjf: string;\n tsjf: string;\n tmai: string;\n dm: string;\n lai: number;\n lei: number;\n asps: number;\n wid: number;\n hei: number;\n };\n\n export type TilemapNetworkSyncData = ObjectNetworkSyncData &\n TilemapNetworkSyncDataType;\n\n /**\n * Displays a Tilemap object (LDtk and Tiled).\n */\n export class TileMapRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.Scalable, gdjs.OpacityHandler {\n _frameElapsedTime: float = 0;\n _opacity: float;\n _tilemapJsonFile: string;\n _tilesetJsonFile: string;\n _tilemapAtlasImage: string;\n _displayMode: string;\n _layerIndex: integer;\n _levelIndex: integer;\n _animationSpeedScale: number;\n _animationFps: number;\n _tileMapManager: gdjs.TileMap.TileMapRuntimeManager;\n _renderer: gdjs.TileMapRuntimeObjectPixiRenderer;\n\n constructor(instanceContainer: gdjs.RuntimeInstanceContainer, objectData) {\n super(instanceContainer, objectData);\n this._opacity = objectData.content.opacity;\n this._tilemapJsonFile = objectData.content.tilemapJsonFile;\n this._tilesetJsonFile = objectData.content.tilesetJsonFile;\n this._tilemapAtlasImage = objectData.content.tilemapAtlasImage;\n this._displayMode = objectData.content.displayMode;\n this._layerIndex = objectData.content.layerIndex;\n this._levelIndex = objectData.content.levelIndex;\n this._animationSpeedScale = objectData.content.animationSpeedScale;\n this._animationFps = objectData.content.animationFps;\n this._tileMapManager = gdjs.TileMap.TileMapRuntimeManager.getManager(\n instanceContainer\n );\n this._renderer = new gdjs.TileMapRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n this._updateTileMap();\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n if (this._animationSpeedScale <= 0 || this._animationFps === 0) {\n return;\n }\n const elapsedTime = this.getElapsedTime() / 1000;\n this._frameElapsedTime += elapsedTime * this._animationSpeedScale;\n while (this._frameElapsedTime > 1 / this._animationFps) {\n this._renderer.incrementAnimationFrameX(instanceContainer);\n this._frameElapsedTime -= 1 / this._animationFps;\n }\n }\n\n updateFromObjectData(\n oldObjectData: TilemapObjectData,\n newObjectData: TilemapObjectData\n ): boolean {\n if (oldObjectData.content.opacity !== newObjectData.content.opacity) {\n this.setOpacity(newObjectData.content.opacity);\n }\n if (\n oldObjectData.content.tilemapJsonFile !==\n newObjectData.content.tilemapJsonFile\n ) {\n this.setTilemapJsonFile(newObjectData.content.tilemapJsonFile);\n }\n if (\n oldObjectData.content.tilesetJsonFile !==\n newObjectData.content.tilesetJsonFile\n ) {\n this.setTilesetJsonFile(newObjectData.content.tilesetJsonFile);\n }\n if (\n oldObjectData.content.displayMode !== newObjectData.content.displayMode\n ) {\n this.setDisplayMode(newObjectData.content.displayMode);\n }\n if (\n oldObjectData.content.layerIndex !== newObjectData.content.layerIndex\n ) {\n this.setLayerIndex(newObjectData.content.layerIndex);\n }\n if (\n oldObjectData.content.levelIndex !== newObjectData.content.levelIndex\n ) {\n this.setLevelIndex(newObjectData.content.levelIndex);\n }\n if (\n oldObjectData.content.animationSpeedScale !==\n newObjectData.content.animationSpeedScale\n ) {\n this.setAnimationSpeedScale(newObjectData.content.animationSpeedScale);\n }\n if (\n oldObjectData.content.animationFps !==\n newObjectData.content.animationFps\n ) {\n this.setAnimationFps(newObjectData.content.animationFps);\n }\n if (\n oldObjectData.content.tilemapAtlasImage !==\n newObjectData.content.tilemapAtlasImage\n ) {\n // TODO: support changing the atlas texture\n return false;\n }\n return true;\n }\n\n getNetworkSyncData(): TilemapNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n op: this._opacity,\n tmjf: this._tilemapJsonFile,\n tsjf: this._tilesetJsonFile,\n tmai: this._tilemapAtlasImage,\n dm: this._displayMode,\n lai: this._layerIndex,\n lei: this._levelIndex,\n asps: this._animationSpeedScale,\n wid: this.getWidth(),\n hei: this.getHeight(),\n };\n }\n\n updateFromNetworkSyncData(networkSyncData: TilemapNetworkSyncData): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n if (networkSyncData.op !== undefined) {\n this.setOpacity(networkSyncData.op);\n }\n if (networkSyncData.tmjf !== undefined) {\n this.setTilemapJsonFile(networkSyncData.tmjf);\n }\n if (networkSyncData.tsjf !== undefined) {\n this.setTilesetJsonFile(networkSyncData.tsjf);\n }\n if (networkSyncData.tmai !== undefined) {\n this._tilemapAtlasImage = networkSyncData.tmai;\n }\n if (networkSyncData.dm !== undefined) {\n this.setDisplayMode(networkSyncData.dm);\n }\n if (networkSyncData.lai !== undefined) {\n this.setLayerIndex(networkSyncData.lai);\n }\n if (networkSyncData.lei !== undefined) {\n this.setLevelIndex(networkSyncData.lei);\n }\n if (networkSyncData.asps !== undefined) {\n this.setAnimationSpeedScale(networkSyncData.asps);\n }\n if (networkSyncData.wid !== undefined) {\n this.setWidth(networkSyncData.wid);\n }\n if (networkSyncData.hei !== undefined) {\n this.setHeight(networkSyncData.hei);\n }\n }\n\n extraInitializationFromInitialInstance(initialInstanceData): void {\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 private _updateTileMap(): void {\n this._tileMapManager.getOrLoadTileMap(\n this._tilemapJsonFile,\n this._tilesetJsonFile,\n this._levelIndex,\n (tileMap: TileMapHelper.EditableTileMap | null) => {\n if (!tileMap) {\n // getOrLoadTileMap already warn.\n return;\n }\n this._tileMapManager.getOrLoadTextureCache(\n (textureName) => {\n const game = this.getInstanceContainer().getGame();\n const mappedName = game.resolveEmbeddedResource(\n this._tilemapJsonFile,\n textureName\n );\n return (game\n .getImageManager()\n .getPIXITexture(mappedName) as unknown) as PIXI.BaseTexture<\n PIXI.Resource\n >;\n },\n this._tilemapAtlasImage,\n this._tilemapJsonFile,\n this._tilesetJsonFile,\n this._levelIndex,\n (textureCache: TileMapHelper.TileTextureCache | null) => {\n if (!textureCache) {\n // getOrLoadTextureCache already log warns and errors.\n return;\n }\n this._renderer.updatePixiTileMap(tileMap, textureCache);\n }\n );\n }\n );\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n /**\n * Set the Tilemap file to display.\n */\n setTilemapJsonFile(tilemapJsonFile: string): void {\n this._tilemapJsonFile = tilemapJsonFile;\n this._updateTileMap();\n }\n\n getTilemapJsonFile(): string {\n return this._tilemapJsonFile;\n }\n\n isTilemapJsonFile(selectedTilemapJsonFile: string): boolean {\n return this._tilemapJsonFile === selectedTilemapJsonFile;\n }\n\n setTilesetJsonFile(tilesetJsonFile: string): void {\n this._tilesetJsonFile = tilesetJsonFile;\n this._updateTileMap();\n }\n\n getTilesetJsonFile(): string {\n return this._tilesetJsonFile;\n }\n\n setAnimationFps(animationFps: float) {\n this._animationFps = animationFps;\n }\n\n getAnimationFps(): float {\n return this._animationFps;\n }\n\n isTilesetJsonFile(selectedTilesetJsonFile: string): boolean {\n return this._tilesetJsonFile === selectedTilesetJsonFile;\n }\n\n isDisplayMode(selectedDisplayMode: string): boolean {\n return this._displayMode === selectedDisplayMode;\n }\n\n setDisplayMode(displayMode: string): void {\n this._displayMode = displayMode;\n this._updateTileMap();\n }\n\n getDisplayMode(): string {\n return this._displayMode;\n }\n\n setLayerIndex(layerIndex): void {\n this._layerIndex = layerIndex;\n this._updateTileMap();\n }\n\n getLayerIndex(): integer {\n return this._layerIndex;\n }\n\n setLevelIndex(levelIndex): void {\n this._levelIndex = levelIndex;\n this._updateTileMap();\n }\n\n getLevelIndex() {\n return this._levelIndex;\n }\n\n setAnimationSpeedScale(animationSpeedScale): void {\n this._animationSpeedScale = animationSpeedScale;\n }\n\n getAnimationSpeedScale(): float {\n return this._animationSpeedScale;\n }\n\n setWidth(width: float): void {\n if (this.getWidth() === width) return;\n\n this._renderer.setWidth(width);\n this.invalidateHitboxes();\n }\n\n setHeight(height: float): void {\n if (this.getHeight() === height) return;\n\n this._renderer.setHeight(height);\n this.invalidateHitboxes();\n }\n\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\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 = this.getScaleX();\n const scaleY = this.getScaleY();\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Change the scale on X and Y axis of the object.\n *\n * @param scale The new scale (must be greater than 0).\n */\n setScale(scale: float): void {\n this.setScaleX(scale);\n this.setScaleY(scale);\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param scaleX The new scale (must be greater than 0).\n */\n setScaleX(scaleX: float): void {\n if (scaleX < 0) {\n scaleX = 0;\n }\n if (this.getScaleX() === scaleX) return;\n\n this._renderer.setScaleX(scaleX);\n this.invalidateHitboxes();\n }\n\n /**\n * Change the scale on Y axis of the object (changing its width).\n *\n * @param scaleY The new scale (must be greater than 0).\n */\n setScaleY(scaleY: float): void {\n if (scaleY < 0) {\n scaleY = 0;\n }\n if (this.getScaleY() === scaleY) return;\n\n this._renderer.setScaleY(scaleY);\n this.invalidateHitboxes();\n }\n\n setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n setOpacity(opacity: float): void {\n this._opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n getOpacity(): float {\n return this._opacity;\n }\n\n getWidth(): float {\n return this._renderer.getWidth();\n }\n\n getHeight(): float {\n return this._renderer.getHeight();\n }\n\n getScaleX(): float {\n return this._renderer.getScaleX();\n }\n\n getScaleY(): float {\n return this._renderer.getScaleY();\n }\n }\n gdjs.registerObject('TileMap::TileMap', gdjs.TileMapRuntimeObject);\n}\n"],
5
+ "mappings": "AACA,GAAU,MAAV,UAAU,EAAV,CAoCS,eACG,GAAK,aACiD,CAc9D,YAAY,EAAkD,EAAY,CACxE,MAAM,EAAmB,GAd3B,uBAA2B,EAezB,KAAK,SAAW,EAAW,QAAQ,QACnC,KAAK,iBAAmB,EAAW,QAAQ,gBAC3C,KAAK,iBAAmB,EAAW,QAAQ,gBAC3C,KAAK,mBAAqB,EAAW,QAAQ,kBAC7C,KAAK,aAAe,EAAW,QAAQ,YACvC,KAAK,YAAc,EAAW,QAAQ,WACtC,KAAK,YAAc,EAAW,QAAQ,WACtC,KAAK,qBAAuB,EAAW,QAAQ,oBAC/C,KAAK,cAAgB,EAAW,QAAQ,aACxC,KAAK,gBAAkB,EAAK,QAAQ,sBAAsB,WACxD,GAEF,KAAK,UAAY,GAAI,GAAK,6BACxB,KACA,GAEF,KAAK,iBAGL,KAAK,YAGP,mBAAoB,CAClB,MAAO,MAAK,UAAU,oBAGxB,OAAO,EAAwD,CAC7D,GAAI,KAAK,sBAAwB,GAAK,KAAK,gBAAkB,EAC3D,OAEF,KAAM,GAAc,KAAK,iBAAmB,IAE5C,IADA,KAAK,mBAAqB,EAAc,KAAK,qBACtC,KAAK,kBAAoB,EAAI,KAAK,eACvC,KAAK,UAAU,yBAAyB,GACxC,KAAK,mBAAqB,EAAI,KAAK,cAIvC,qBACE,EACA,EACS,CA2CT,MA1CI,GAAc,QAAQ,UAAY,EAAc,QAAQ,SAC1D,KAAK,WAAW,EAAc,QAAQ,SAGtC,EAAc,QAAQ,kBACtB,EAAc,QAAQ,iBAEtB,KAAK,mBAAmB,EAAc,QAAQ,iBAG9C,EAA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wBAAgC,CAC9B,MAAO,MAAK,qBAGd,SAAS,EAAoB,CAC3B,AAAI,KAAK,aAAe,GAExB,MAAK,UAAU,SAAS,GACxB,KAAK,sBAGP,UAAU,EAAqB,CAC7B,AAAI,KAAK,cAAgB,GAEzB,MAAK,UAAU,UAAU,GACzB,KAAK,sBAGP,QAAQ,EAAiB,EAAwB,CAC/C,KAAK,SAAS,GACd,KAAK,UAAU,GAQjB,UAAkB,CAChB,KAAM,GAAS,KAAK,YACd,EAAS,KAAK,YACpB,MAAO,KAAW,EAAS,EAAS,KAAK,KAAK,EAAS,GAQzD,SAAS,EAAoB,CAC3B,KAAK,UAAU,GACf,KAAK,UAAU,GAQjB,UAAU,EAAqB,CAI7B,AAHI,EAAS,GACX,GAAS,GAEP,KAAK,cAAgB,GAEzB,MAAK,UAAU,UAAU,GACzB,KAAK,sBAQP,UAAU,EAAqB,CAI7B,AAHI,EAAS,GACX,GAAS,GAEP,KAAK,cAAgB,GAEzB,MAAK,UAAU,UAAU,GACzB,KAAK,sBAGP,KAAK,EAAgB,CACnB,MAAM,KAAK,GACX,KAAK,UAAU,iBAGjB,KAAK,EAAgB,CACnB,MAAM,KAAK,GACX,KAAK,UAAU,iBAGjB,SAAS,EAAoB,CAC3B,MAAM,SAAS,GACf,KAAK,UAAU,cAGjB,WAAW,EAAsB,CAC/B,KAAK,SAAW,EAChB,KAAK,UAAU,gBAGjB,YAAoB,CAClB,MAAO,MAAK,SAGd,UAAkB,CAChB,MAAO,MAAK,UAAU,WAGxB,WAAmB,CACjB,MAAO,MAAK,UAAU,YAGxB,WAAmB,CACjB,MAAO,MAAK,UAAU,YAGxB,WAAmB,CACjB,MAAO,MAAK,UAAU,aAhZnB,EAAM,uBAmZb,EAAK,eAAe,mBAAoB,EAAK,wBAvbrC",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(i){class r extends i.RuntimeObject{constructor(e,t){super(e,t);this._xOffset=0;this._yOffset=0;this.opacity=255;this._renderer=new i.TiledSpriteRuntimeObjectRenderer(this,e,t.texture),this._width=0,this._height=0,this.setWidth(t.width),this.setHeight(t.height),this.onCreated()}updateFromObjectData(e,t){return e.texture!==t.texture&&this.setTexture(t.texture,this.getRuntimeScene()),e.width!==t.width&&this.setWidth(t.width),e.height!==t.height&&this.setHeight(t.height),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),wid:this.getWidth(),hei:this.getHeight(),xo:this.getXOffset(),yo:this.getYOffset(),op:this.getOpacity(),color:this.getColor()}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),e.wid!==void 0&&this.setWidth(e.wid),e.hei!==void 0&&this.setHeight(e.hei),e.xo!==void 0&&this.setXOffset(e.xo),e.yo!==void 0&&this.setYOffset(e.yo),e.op!==void 0&&this.setOpacity(e.op),e.color!==void 0&&this.setColor(e.color)}getRendererObject(){return this._renderer.getRendererObject()}onDestroyed(){super.onDestroyed(),this._renderer.destroy()}extraInitializationFromInitialInstance(e){e.customSize&&(this.setWidth(e.width),this.setHeight(e.height))}setX(e){super.setX(e),this._renderer.updatePosition()}setY(e){super.setY(e),this._renderer.updatePosition()}setTexture(e,t){this._renderer.setTexture(e,t)}setAngle(e){super.setAngle(e),this._renderer.updateAngle()}getWidth(){return this._width}getHeight(){return this._height}setWidth(e){this._width!==e&&(this._width=e,this._renderer.setWidth(e),this.invalidateHitboxes())}setHeight(e){this._height!==e&&(this._height=e,this._renderer.setHeight(e),this.invalidateHitboxes())}setSize(e,t){this.setWidth(e),this.setHeight(t)}setXOffset(e){this._xOffset=e,this._renderer.updateXOffset()}setYOffset(e){this._yOffset=e,this._renderer.updateYOffset()}getXOffset(){return this._xOffset}getYOffset(){return this._yOffset}setOpacity(e){e<0&&(e=0),e>255&&(e=255),this.opacity=e,this._renderer.updateOpacity()}getOpacity(){return this.opacity}setColor(e){this._renderer.setColor(e)}getColor(){return this._renderer.getColor()}getScale(){const e=Math.abs(this.getScaleX()),t=Math.abs(this.getScaleY());return e===t?e:Math.sqrt(e*t)}getScaleX(){return this._width/this._renderer.getTextureWidth()}getScaleY(){return this._height/this._renderer.getTextureHeight()}setScale(e){this.setWidth(this._renderer.getTextureWidth()*e),this.setHeight(this._renderer.getTextureHeight()*e)}setScaleX(e){this.setWidth(this._renderer.getTextureWidth()*e)}setScaleY(e){this.setHeight(this._renderer.getTextureHeight()*e)}}i.TiledSpriteRuntimeObject=r,i.registerObject("TiledSpriteObject::TiledSprite",i.TiledSpriteRuntimeObject)})(gdjs||(gdjs={}));
1
+ var gdjs;(function(i){class r extends i.RuntimeObject{constructor(e,t){super(e,t);this._xOffset=0;this._yOffset=0;this.opacity=255;this._renderer=new i.TiledSpriteRuntimeObjectRenderer(this,e,t.texture),this._width=0,this._height=0,this.setWidth(t.width),this.setHeight(t.height),this.onCreated()}updateFromObjectData(e,t){return e.texture!==t.texture&&this.setTexture(t.texture,this.getRuntimeScene()),e.width!==t.width&&this.setWidth(t.width),e.height!==t.height&&this.setHeight(t.height),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),wid:this.getWidth(),hei:this.getHeight(),xo:this.getXOffset(),yo:this.getYOffset(),op:this.getOpacity(),color:this.getColor()}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),e.wid!==void 0&&this.setWidth(e.wid),e.hei!==void 0&&this.setHeight(e.hei),e.xo!==void 0&&this.setXOffset(e.xo),e.yo!==void 0&&this.setYOffset(e.yo),e.op!==void 0&&this.setOpacity(e.op),e.color!==void 0&&this.setColor(e.color)}getRendererObject(){return this._renderer.getRendererObject()}onDestroyed(){super.onDestroyed(),this._renderer.destroy()}extraInitializationFromInitialInstance(e){e.customSize&&(this.setWidth(e.width),this.setHeight(e.height)),e.opacity!==void 0&&this.setOpacity(e.opacity)}setX(e){super.setX(e),this._renderer.updatePosition()}setY(e){super.setY(e),this._renderer.updatePosition()}setTexture(e,t){this._renderer.setTexture(e,t)}setAngle(e){super.setAngle(e),this._renderer.updateAngle()}getWidth(){return this._width}getHeight(){return this._height}setWidth(e){this._width!==e&&(this._width=e,this._renderer.setWidth(e),this.invalidateHitboxes())}setHeight(e){this._height!==e&&(this._height=e,this._renderer.setHeight(e),this.invalidateHitboxes())}setSize(e,t){this.setWidth(e),this.setHeight(t)}setXOffset(e){this._xOffset=e,this._renderer.updateXOffset()}setYOffset(e){this._yOffset=e,this._renderer.updateYOffset()}getXOffset(){return this._xOffset}getYOffset(){return this._yOffset}setOpacity(e){e<0&&(e=0),e>255&&(e=255),this.opacity=e,this._renderer.updateOpacity()}getOpacity(){return this.opacity}setColor(e){this._renderer.setColor(e)}getColor(){return this._renderer.getColor()}getScale(){const e=Math.abs(this.getScaleX()),t=Math.abs(this.getScaleY());return e===t?e:Math.sqrt(e*t)}getScaleX(){return this._width/this._renderer.getTextureWidth()}getScaleY(){return this._height/this._renderer.getTextureHeight()}setScale(e){this.setWidth(this._renderer.getTextureWidth()*e),this.setHeight(this._renderer.getTextureHeight()*e)}setScaleX(e){this.setWidth(this._renderer.getTextureWidth()*e)}setScaleY(e){this.setHeight(this._renderer.getTextureHeight()*e)}}i.TiledSpriteRuntimeObject=r,i.registerObject("TiledSpriteObject::TiledSprite",i.TiledSpriteRuntimeObject)})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=tiledspriteruntimeobject.js.map