Jump to content

Phaser group with graphics


lvaldivia
 Share

Recommended Posts

Hi I was using phaser 2.2.2 and I used to do this:

var rects = game.add.group();var col = 0;var row = -1;for(var i=0;i<50;i++){var rect = game.add.graphics(0,0);rect.beginFill(0xFFF000);rect.drawRect(0,0,50,50);rect.endFill();col = i % 10;if(col==0){row++;}rect.x = col *(rect.width+10);rect.y = row*(rect.height+10);rects.addChild(rect);}console.log(rects.width);

 

 
When I print the full width of the group I got all of it, but when I updated to 2.3 It only print the width of only one rectangle. This only happen with graphics.
 
When I use sprites I have no problem with that
 
Maybe I am doing something wrong, any help?
 
Thanks
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...