pumuky Posted January 23, 2015 Share Posted January 23, 2015 Hi!One and quick question... Using groups, is there any diference (in terms of performance) betweenphaserGroup.alpha = 0;and phaserGroup.visible = 0;? This question is also extensible to sprites... Thanks Link to comment Share on other sites More sharing options...
valueerror Posted January 23, 2015 Share Posted January 23, 2015 as far as i know visible=0; disables the rendering of the object completely so it should be better.. Link to comment Share on other sites More sharing options...
mariogarranz Posted January 23, 2015 Share Posted January 23, 2015 I don't remember where, but reading the source code I'm sure it said both alpha = 0 and visible = false meant the object was not going to be rendered at all, so I'd say they are the same. Link to comment Share on other sites More sharing options...
valueerror Posted January 23, 2015 Share Posted January 23, 2015 well this is the information i got here: https://github.com/photonstorm/phaser/issues/839#issuecomment-43753560 i testet this with 2 tilemap layers which had a noticable impact on performance.. so i guess lewster was right... alpha=0; may not draw it but probably still does some calculations on it somehow somwhere.. maybe this changed since i made this post.. could you provide a link to the source? im curious Link to comment Share on other sites More sharing options...
rich Posted January 23, 2015 Share Posted January 23, 2015 They're both the same. Sprites are skipped for rendering if alpha 0 or visible false: https://github.com/photonstorm/phaser/blob/master/src/pixi/display/Sprite.js#L333 codevinsky, Fenopiù, in mono and 1 other 4 Link to comment Share on other sites More sharing options...
valueerror Posted January 23, 2015 Share Posted January 23, 2015 thx rich for clearing that up Link to comment Share on other sites More sharing options...
pumuky Posted January 23, 2015 Author Share Posted January 23, 2015 Thanks to all! Link to comment Share on other sites More sharing options...
codevinsky Posted January 23, 2015 Share Posted January 23, 2015 Just to be clear:An object that has visible = false, or alpha = 0 will still get interpreted by the physics engine for collisions, correct? Link to comment Share on other sites More sharing options...
rich Posted January 23, 2015 Share Posted January 23, 2015 Yes. The only thing that stops physics is setting Body.enable to false. in mono 1 Link to comment Share on other sites More sharing options...
Recommended Posts