Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Does using groups affect performance?


tips4design
 Share

Recommended Posts

I noticed that when you use groups the group layer size is as large as the longest distance horizontally and vertically between the sprites it contains, even though the sprites are off-screen. 

 

Groups are actually DisplayObjectContainers, so that means their canvas (I guess) is going to be that large, even though sometimes it can be much smaller (never larger than the screen).

 

Also, does using groups mean that the sprites are drawn twice? (first on the group and then the group canvas on the world) 

If this is the case, then if you have multiple nested groups then the sprite will be re-drawn a multiple times (even though none of the container groups alter it's position, scale or anything like that).

 

So, is this how groups work? Does using groups affect performance by using multiple large-size textures? (eg. you have a pixel at 0.0 and one pixel at 1600.1600 and add them in a group, now instead of drawing two pixels you will draw a group of size 1600x1600)

Link to comment
Share on other sites

The canvas is only ever the size you specify in the game constructor. Groups, Sprites, etc do not have their own canvas elements by default. Only if you call cacheAsBitmap on them will it do that, and even then only in Canvas mode. In WebGL it sets up a sprite batch instead.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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