plicatibu Posted November 1, 2013 Share Posted November 1, 2013 It seems that phase doesn't provide a HUD class. I'm wondering which is the best way to implement it. Regards. Link to comment Share on other sites More sharing options...
rich Posted November 1, 2013 Share Posted November 1, 2013 No it's too game specific, anything we provide would only cater for a small set of games. I'd suggest you just create a Group and put all your HUD related items in it, then just keep that Group on the top of your game. Link to comment Share on other sites More sharing options...
plicatibu Posted November 1, 2013 Author Share Posted November 1, 2013 Almost all my problems developing with phaser is because my (lack of) knowledge of javascript (but I'm working to improve it). I'll give it a try on groups. Thank you. Link to comment Share on other sites More sharing options...
beeglebug Posted November 1, 2013 Share Posted November 1, 2013 Also, if you have a world which is larger than the stage, you will probably want to usesprite.fixedToCamera = true;to keep the hud anchored to the screen when the camera moves. plicatibu 1 Link to comment Share on other sites More sharing options...
plicatibu Posted November 1, 2013 Author Share Posted November 1, 2013 beeglebug, it's a really useful information. Thank you. Link to comment Share on other sites More sharing options...
erasmosoares Posted November 6, 2013 Share Posted November 6, 2013 That was my solution, just as rich says about using group, you can do a class extending a group as well: function HUD(game, parent, name, useStage) { Phaser.Group.call(this, game, parent, name, useStage); //Your elements here.}; HUD.prototype = Object.create( Phaser.Group.prototype);HUD.prototype.constructor = HUD; ----------- I don't know how to set the current focus to the group. plicatibu 1 Link to comment Share on other sites More sharing options...
Recommended Posts