Hi all,
I've coded a general pop-up when picking up an item so that the player gets feedback it is added to their inventory using the Tween module. However it halts the entire script which is very inconvenient. I've tried with WaitSeconds and the Tween StartDelay, but neither of these continue the script. If I remove the eNoBlockTween it doesn't wait at all to show the item and just eases in and out immediately.
Does anyone know a way to still show the item for 3 seconds before easing out the pop-up without halting the game?
function InvPopAdd(int item)
{
gInvPopup.SetPosition(-79, 569);
gInvPopup.Visible = true;
btnInvPop.NormalGraphic = item;
gInvPopup.TweenX(0.3, 0, eEaseOutSineTween);
//WaitSeconds(3.0); //has same result as below
gInvPopup.TweenY(0.6, 768, eEaseOutSineTween, eNoBlockTween, 3.0);
gInvPopup.Visible = false;
}
I think the first thing you should check the GUI Visibility property to make sure that it's on "Normal, initially off" and not on "Pause game when shown".
Otherwise the game will pause the moment the pop-up shows up.
You need this:
function InvPopAdd(int item)
{
gInvPopup.SetPosition(-79, 569);
gInvPopup.Visible = true;
btnInvPop.NormalGraphic = item;
gInvPopup.TweenX(0.3, 0, eEaseOutSineTween, eNoBlockTween, 3.0);
SetTimer(1, 3 * GetGameSpeed()); // schedule removing the popup
}
// in repeatedly_execute_always
if (IsTimerExpired(1)) {
gInvPopup.TweenY(0.6, 768, eEaseOutSineTween, eNoBlockTween, 3.0);
}
Thanks!