Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
priority of the image — Gideros Forum

priority of the image

JackoJacko Member
edited March 2015 in General questions
Hello guys,
How can I give a set of priority of the image, so that no other image is unable to cover him? :)

Comments

  • piepie Member
    edited March 2015
    Hi @Jacko you can't give a "priority", you can compose your screen with a predefined order (last child added is on top) or call the functions by ar2sawseen on the sprite you need to be in front/back.

    Taken from giderosCodingEasy. https://github.com/ar2rsawseen/GiderosCodingEasy/blob/master/GiderosCodingEasy.lua
    --[[ z-axis manipulations ]]--
    function Sprite:bringToFront()
    local parent = self:getParent()
    if parent then
    parent:addChild(self)
    end
    return self
    end
     
    function Sprite:sendToBack()
    local parent = self:getParent()
    if parent then
    parent:addChildAt(self, 1)
    end
    return self
    end

    I forgot, there is another way:
    if you have 2 sprites:
    BackGround and ForeGround
    and you add them to the same parent (like stage) in their "order"

    stage:addChild(background)
    stage:addChild(ForeGround)

    if you addChild(s) to background, ForeGround should remain on top of them all. :)
Sign In or Register to comment.