jjwallace Posted February 29, 2016 Share Posted February 29, 2016 //var uiGroup; uiGroup = this.add.group(); uiGroup.create(this.world.width, this.world.height, 'guiGroup'); uiGroup.anchor.setTo(1,0); ERROR Uncaught TypeError: Cannot read property 'setTo' of undefined Link to comment Share on other sites More sharing options...
rich Posted February 29, 2016 Share Posted February 29, 2016 Groups don't have anchors, because they don't have textures. Anchors are for texture alignment. Link to comment Share on other sites More sharing options...
jjwallace Posted March 1, 2016 Author Share Posted March 1, 2016 Hmmm. Well i would really like to place a few buttons and some text fields inside a group and align it to the right. Essential making a nice GUI, i am trying to find the best method to do this. I am guessing to align a group you must just subtract its width and then set its x to the right side. Interesting. Link to comment Share on other sites More sharing options...
rich Posted March 1, 2016 Share Posted March 1, 2016 If you need it to be right-aligned then you could use a negative offset for its children. Group children are positioned relative to the Group coordinates. So if you had a few buttons that were 100px wide, and position them at x: -100 within the Group, then you could position the Group at the far-right of the game and the buttons would be right-aligned correctly. Link to comment Share on other sites More sharing options...
jjwallace Posted March 28, 2016 Author Share Posted March 28, 2016 Awesome! I like how groups work, its pretty nifty! Link to comment Share on other sites More sharing options...
Recommended Posts