@@ -45,7 +45,7 @@ namespace gdjs {
45
45
readonly _tileSize : number ;
46
46
_displayMode = 'all' ;
47
47
_layerIndex = 0 ;
48
- _initialTileMapAsJsObject : TileMapHelper . EditableTileMapAsJsObject | null = null ;
48
+ _initialTileMapAsJsObject : TileMapHelper . EditableTileMapAsJsObject ;
49
49
readonly _initialTilesWithHitBox : number [ ] ;
50
50
_isTileMapDirty : boolean = false ;
51
51
_sceneToTileMapTransformation : gdjs . AffineTransformation = new gdjs . AffineTransformation ( ) ;
@@ -66,6 +66,13 @@ namespace gdjs {
66
66
this . _rowCount = objectData . content . rowCount ;
67
67
this . _columnCount = objectData . content . columnCount ;
68
68
this . _tileSize = objectData . content . tileSize ;
69
+ this . _initialTileMapAsJsObject = {
70
+ tileWidth : this . _tileSize ,
71
+ tileHeight : this . _tileSize ,
72
+ dimX : 1 ,
73
+ dimY : 1 ,
74
+ layers : [ { id : 0 , alpha : this . _opacity , tiles : [ ] } ] ,
75
+ } ;
69
76
this . _initialTilesWithHitBox = ( objectData . content
70
77
. tilesWithHitBox as string )
71
78
. split ( ',' )
@@ -79,6 +86,17 @@ namespace gdjs {
79
86
instanceContainer
80
87
) ;
81
88
89
+ this . _loadInitialTileMap ( ( tileMap : TileMapHelper . EditableTileMap ) => {
90
+ this . _renderer . updatePosition ( ) ;
91
+
92
+ this . _collisionTileMap = new gdjs . TileMap . TransformedCollisionTileMap (
93
+ tileMap ,
94
+ this . _hitBoxTag
95
+ ) ;
96
+
97
+ this . updateTransformation ( ) ;
98
+ } ) ;
99
+
82
100
// *ALWAYS* call `this.onCreated()` at the very end of your object constructor.
83
101
this . onCreated ( ) ;
84
102
}
0 commit comments