hide sprite for actor vs. set opacity to 0

designpeg

  • *
  • Posts: 731
does anyone know if it's better in terms of cpu usage to reduce opacity to zero, or use the hide sprite block, or is there no real difference?

Bombini

  • Posts: 1397
I would simply switch animations of the actor to an empty animation. I use this all the time.
Cheers!

BMJ

  • Posts: 278
I was recently told by someone on the Stencyl team that "hide layer" is the same as setting the layer opacity equal to zero, so I would assume that the same holds true for sprites, but I suppose I can't say that with 100% certainty.

captaincomic

  • *
  • Posts: 6108
"hide sprite for Actor" calls the disableActorDrawing() function, which looks like this:
Code: [Select]
public function disableActorDrawing()
{
drawActor = false;

if(currAnimation != null)
{
currAnimation.visible = false;
}

for(anim in animationMap)
{
if(anim != null)
{
anim.visible = false;
}
}
}

And in the drawing methods there are many checks "if (drawActor)" that will be skipped if set to false, so I guess this is more efficient. But I have no idea if the difference is actually noticable