Kamaz

Members
  • Content count

    2
  • Joined

  • Last visited

  1. Input events

    I draw all the game objects (images, animations, fonts) using renderTexture in State.Update(). Is there any way to handle mouse events? Without adding to the stage. Simple example, events don't work: public create(): void { let self = this; this.texture = this.game.add.renderTexture(this.game.width, this.game.height); this.game.add.sprite(0, 0, this.texture); this.image = this.parentGame.game.make.sprite(0, 0, this.filename); this.image.inputEnabled = true; this.image.input.useHandCursor = true; this.image.events.onInputDown.add(function () { if (self.onMouseEvent) { self.onMouseEvent(); } }); } public update(): void { this.texture.renderXY(this.image, 0, 0, this.clearBeforeDraw); }
  2. Game resources from bindata.

    I receive the encrypted file from the server containing the sounds, images, atlases. I found a solution how to get the image from the data array. let imageData = window.DWP(dataArray); let bmd:Phaser.BitmapData = this.game.add.bitmapData(imageData.width, imageData.height, key, true); bmd.ctx.putImageData(imageData, 0, 0); let imageSprite:Phaser.Sprite = this.game.make.sprite(this.currentImageXPos, 0, bmd.texture); How to work with other resource types, such as sounds and xml? Thank you