diff --git a/2xswm1bwq8.js b/2xswm1bwq8.js index 591b616..0c43b1b 100644 --- a/2xswm1bwq8.js +++ b/2xswm1bwq8.js @@ -21,7 +21,11 @@ this.image_4 = GameLib.EntityManager.Instance.findComponentById('5t3olr10pw'); this.image_5 = GameLib.EntityManager.Instance.findComponentById('qrh0foyins'); this.image_6 = GameLib.EntityManager.Instance.findComponentById('0bjbsj4sss'); -this.boxCenter = GameLib.EntityManager.Instance.findComponentById('nazmn9boih'); +/** + * Scene + */ +this.scene = GameLib.EntityManager.Instance.findComponentById('i1ac678a5d'); + this.animation = GameLib.EntityManager.Instance.findComponentById('tnlwgvf12x'); this.canvas = GameLib.EntityManager.Instance.findComponentById('85d0jk6dhx'); this.burnLight = GameLib.EntityManager.Instance.findComponentById('yy6ef7ur7m'); @@ -921,7 +925,7 @@ GameLib.CustomCode.prototype.spawnBlock = function () { var nextPositionX = 0; var nextPositionY = 0; - var center = this.boxCenter.clone(); + var center = this.tile_center.clone(); center.position.y = 0; center.position.x = 0; @@ -1349,41 +1353,58 @@ if (GameLib.Utils.UndefinedOrNull(this.subscriptions)) { } GameLib.CustomCode.prototype.createTile = function(tileName, imageName) { + + var apiMaterial; + + if (imageName) { + apiMaterial = new GameLib.D3.API.Material.Phong( + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + new GameLib.D3.API.Texture.Image( + null, + this[imageName] + ) + ) + } else { + apiMaterial = new GameLib.D3.API.Material.Phong(); + } + this[tileName] = new GameLib.D3.Mesh( this.graphics, new GameLib.D3.API.Mesh( null, null, null, - this.parentEntity, + null, new GameLib.D3.API.Geometry.Buffer.Plane(), [ - new GameLib.D3.API.Material.Phong( - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - new GameLib.D3.API.Texture.Image( - null, - this[imageName] - ) - ) - ] + apiMaterial + ], + null, + this.scene ) ) + + /** + * Remove this tile from the 'meshes' so it is treated like a clone and doesn't get stored + */ + this[tileName].parentScene.addClone(this[tileName]); + }.bind(this); GameLib.Event.Emit( @@ -1400,6 +1421,7 @@ GameLib.Event.Emit( this.createTile('tile_4', 'image_4'); this.createTile('tile_5', 'image_5'); this.createTile('tile_6', 'image_6'); + this.createTile('tile_center') GameLib.Event.Emit(GameLib.Event.GAME_LOADED);