(Solved)Trying to run two parallel animations without blocking

Started by FanOfHumor, Wed 29/12/2021 01:45:53

Previous topic - Next topic

FanOfHumor

Hi everyone I've got a script that's been puzzling me for months.

I am trying to play an animation then wait till its finished but wait for user control to play the second and 3rd animation.

Code: ags


  if(mouse.y>1026)
  {
    //play the animation of appearing;
    if(invitem.Animating)
    {}
    else
    {
      invitem.Animate(79, 0, 5, eOnce);
    }  
  }
  if(mouse.y<1024)
  {
    //play the animation of falling;
    if(invitem.Animating)
    {
      invitem.Animate(80, 0, 5, eOnce); 
    }
  }



I have a button in a gui that animates when the mouse moves to the bottom of the screen then animates when the mouse leaves the bottom.

It's like a custom inventory gui that has the inventory items appear then drop when you leave the bottom.

I want to have the item float up then hover and then fall back down again.

The first animation either cuts off the second or the first runs into the second before the user command.


Mandle

Isn't this:

if(mouse.y<1024)
  {
    //play the animation of falling;
    if(invitem.Animating)
    {
      invitem.Animate(80, 0, 5, eOnce);
    }

going to constantly return the object as animating and restart the animation if the mouse.y<1024?

I think you need a variable that you can set and check like 1 if object is animating up -1 if it is animating down and 0 if it is not animating.

FanOfHumor

#2
I've been trying to use variables lots of times and have had some success but maybe your way is different could you be more descriptive on what your saying.

just so you know this is in repeatedly execute always.

are you saying to change the variable everytime the animation is played?



Nevermind what I just wrote. What you said worked out flawlessly.

Thanks

SMF spam blocked by CleanTalk