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 trueMy 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:bitmap = game.add.bitmapData(800, 100);bitmapSprite = game.add.sprite(0, 0, bitmap);bitmapSprite.fixedToCamera = true;Here is the official example for bitmapdata sprites. 这篇关于如何在Phaser中将位图数据固定到相机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的..
09-06 19:12