lua - How to lower alpha behind overlay with composer? -
i trying figure out how fade parent screen reducing it's alpha when overlay shown, return alpha 1 after overlay goes away.
i can seem make work following
function lorebuttontap:tap(e) transition.to(scenegroup,{ alpha= .5, time= 400 })
composer.showoverlay("westeroslore", { effect ="fromtop", time = 800 }) loretap = display.newrect(_w,_h,_w*2,_h*2); display.getcurrentstage():setfocus(loretap) loretap.alpha = 0; loretap.ishittestable = true; loretap:addeventlistener("tap", loretap); function loretap:tap(e) transition.to(scenegroup,{ alpha= 1, time= 400 }) composer.hideoverlay("slideup",400); display.getcurrentstage():setfocus(nil) end
i doing of inside of parent window. problem if player rapidly presses lorebuttontap (spams fast), crashes game claiming composer.hideoverlay("slideup",400);
has become nil
.
am supposed hiding overlay in overlays lua file? there simpler way of doing this?
the best way draw black rectangle in overlay scene , give alpha value. provides illusion of faded parent scene.
Comments
Post a Comment