Animate (NoBlocking) problems.

Started by thehivetyrant, Tue 02/03/2010 14:13:57

Previous topic - Next topic

thehivetyrant

Hi people, sorry for another post.

I'm having a very difficult problem regarding animating with NoBlock.
Allow me to try to set the scene.

When character B collides with character A he changes his view and attacks.
 
  if (cStitches.IsCollidingWithChar(cGrim) == 1)
   {
     cStitches.LockView(VATTACK);
     cStitches.Animate(0, 2, eOnce, eBlock, eForwards);
     if(cStitches.IsCollidingWithChar(cGrim) && cStitches.View == 2 && cStitches.Frame == 5)
       {
          PlayerHP -= 10;
          HP.Width -= 10;
        }
     cStitches.UnlockView();
    }
 

At the moment i have the Animate configured to eBlock, this works okay but the player is unable to move during this which is bad for this game,
If i change it to eNoBlock, then when they collide character B (who should attack) just stands there.

as i understand it, it just skips the function because nothings stopping it.

I tried setting up SetTimer but couldn't get it to work.
And have also tried to set up a global variable but to no avail niether.

Help?

If more code is needed i'll write some up, since i've tried various alternatives to attempt to get it to work i've deleted ones i couldnt get to work, so dont have it on hand.

Thanks Matt!


Khris

Once the condition is fulfilled, it remains fulfilled until the player moves away, so the Animation is constantly started anew, never getting the chance to change the displayed frame.

Try this:
Code: ags
  if (cStitches.IsCollidingWithChar(cGrim) && !cStitches.Animating)  // not animating
  {
    cStitches.LockView(VATTACK);
    cStitches.Animate(0, 2, eOnce, eNoBlock, eForwards);
  }
  if (cStitches.View == VATTACK && cStitches.Frame == 5)  // animation done
  {
    if (cStitches.IsCollidingWithChar(cGrim))
    {
      PlayerHP -= 10;
      HP.Width -= 10;
    }
    cStitches.UnlockView();
  }


This will probably lead to frame 5 not being displayed; if that's the case, append the standing frame to the loop and change the condition to "== 6".

thehivetyrant

oh wow that works great!
I mean, really, wow! :o

really nice one!

Khris


SMF spam blocked by CleanTalk