Sprite:removeFromParent: Difference between revisions

From GiderosMobile
No edit summary
m Text replacement - "</source>" to "</syntaxhighlight>"
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
=== Description ===
=== Description ===
If the sprite has a parent, removes the sprite from the child list of its parent sprite.
If the sprite has a parent, removes the sprite from the child list of its parent sprite.
<source lang="lua">
<syntaxhighlight lang="lua">
Sprite:removeFromParent()
Sprite:removeFromParent()
</source>
</syntaxhighlight>


This function is equilavent to:
This function is equilavent to:
<source lang="lua">
<syntaxhighlight lang="lua">
function Sprite:removeFromParent()
function Sprite:removeFromParent()
local parent = self:getParent()
local parent = self:getParent()
Line 17: Line 17:
end
end
end
end
</source>
</syntaxhighlight>


{{Sprite}}
{{Sprite}}

Latest revision as of 13:33, 13 July 2023

Available since: Gideros 2011.6
Class: Sprite

Description

If the sprite has a parent, removes the sprite from the child list of its parent sprite.

Sprite:removeFromParent()

This function is equilavent to:

function Sprite:removeFromParent()
	local parent = self:getParent()
	if parent ~= nil then
		parent:removeChild(self)
	end
end