I'm having some trouble with bitmapdata and the camera in Phaser.
I'm moving the camera as part of my game because it's a scrolling game. I'm using bitmapdata to draw a health bar, but it keeps scrolling offscreen. :/ So far I've tried:
• Setting the fixedToCamera property to true
• Using the move property to move it along with the scrolling
• Making a sprite and adding the bitmapdata to it as a child and setting the fixedToCamera property to true
My code for adding the bitmapdata to the sprite:
bitmap = Game.make.bitmapData(800, 100)
bitmap.addToWorld(0, 0)
bitmapSprite = Game.add.sprite(0, 0)
bitmapSprite.addChild(bitmap)
I get the following error:
Uncaught TypeError: this.children[t].updateTransform is not a function
at i.Sprite.s.DisplayObjectContainer.updateTransform (phaser.min.js:3)
at i.World.s.DisplayObjectContainer.updateTransform (phaser.min.js:3)
at i.Stage.updateTransform (phaser.min.js:3)
at i.Game.updateLogic (phaser.min.js:3)
at i.Game.update (phaser.min.js:3)
at i.RequestAnimationFrame.updateRAF (phaser.min.js:3)
at window.requestAnimationFrame.forceSetTimeOut._onLoop (phaser.min.js:3)
Try doing it like this:
Here is the official example for bitmapdata sprites.