Apok.pt Posted December 11, 2013 Share Posted December 11, 2013 Hi, I am developing a game TOP VIEW with a large city and I need to create a UI with score, time, etc that follows the camera.I have tried to create a group, text, and cant make any of them follow the camera besides a sprite. Any ideas? Link to comment Share on other sites More sharing options...
jcs Posted December 11, 2013 Share Posted December 11, 2013 set their 'fixedToCamera' prop to true Link to comment Share on other sites More sharing options...
Apok.pt Posted December 12, 2013 Author Share Posted December 12, 2013 fixedToCamera is not available in Phaser.Text I solved it : - Created a Sprite with fixedToCamera = true- addChild of my text at x:0, y:0- position the cameraOffset of my Sprite Link to comment Share on other sites More sharing options...
JHardin1112 Posted January 21, 2014 Share Posted January 21, 2014 fixedToCamera is not available in Phaser.Text I solved it : - Created a Sprite with fixedToCamera = true- addChild of my text at x:0, y:0- position the cameraOffset of my Sprite I am completely new to Phaser and I'm trying to do the same thing. I don't understand your solution. Would you be able to provide some code to explain this fix? Link to comment Share on other sites More sharing options...
XekeDeath Posted January 21, 2014 Share Posted January 21, 2014 //Created a Sprite with fixedToCamera = truevar sprite = game.add.sprite(0,0);sprite.fixedToCamera = true;//addChild of my text at x:0, y:0var text = game.add.text(0,0,"Score: ");sprite.addChild(text);//position the cameraOffset of my Spritesprite.cameraOffset.x = 10;sprite.cameraOffset.y = 100;However, this solution is no longer needed in the latest Phaser code...In the Dev branch, you can fix a text object to the camera Link to comment Share on other sites More sharing options...
4ucai Posted January 22, 2014 Share Posted January 22, 2014 in the dev branch Phaser.Text has a fixedToCamera property Link to comment Share on other sites More sharing options...
JHardin1112 Posted January 22, 2014 Share Posted January 22, 2014 Thank you! This is what I needed! Link to comment Share on other sites More sharing options...
Recommended Posts