Offscreen objects performance: isvisible=false vs alpha=0 vs removeSelf() and =nil

Hi there,

From what I gather:

Setting image.alpha=0 is faster than image.isVisible = false
And storing a co-ordinate in object.xpos is faster than using image.x
What about removing and recreating the images?

I have a lua table object which contains an image group which is made into a physics body. The object handles it’s own calculations regarding positioning regardless of whether the image group body exists or not. So when my object goes off screen I’ll call removeSelf() on the physical image and allow the object to carry on invisibly. Any time the object re-enters the viewing area I’ll recreate the display group and physics object.

I can’t test on a device yet but I really want to build optimal code. I wanted to see of anyone has had any experience with this approach or if my attempts are actually false economy. Will removing and recreating these images be more expensive than simply making them invisible? [import]uid: 31362 topic_id: 6746 reply_id: 306746[/import]

Hi
Can you tell me how you will remove physic from object using isVisible = false ? is it possible ?
I try to use removeSelf() and remove whole table but when I recall table I can’t remove it again.
removeSelf() nill value…
To remove whole table I’am using :
local removeBoards = function()
for k, n in pairs (boards) do
n:removeSelf()
— or
---- n.isVisible = false but this not remove physics
end
end [import]uid: 13156 topic_id: 6746 reply_id: 28904[/import]