Using Animations under the repeatedly execute function.

Started by MugMan, Fri 09/12/2016 19:24:06

Previous topic - Next topic

MugMan

Hello! I was attempting to make a transititon animation of a ghost entering the player and leaving behind an orb, but it seems to be getting stuck on the first animate command! Any help? Should i be running this under something rather than execute always?

Code: ags

  if (cGhost == player) {
 }
 else {
   cGhost.Walk (player.x-20, player.y, eBlock);
   if (cGhost.x == player.x-20) {
    if (cGhost.y == player.y) {
    cGhost.x = player.x-20;
    cGhost.y = player.y;
    cGhost.LockView(4);
    cGhost.Animate (0, 2, eOnce);
    cGhost.LockView(5);
    }
   }


I'd really appreciate any help, cheers!

Cassiebsg

As far as I can see your IFs (cGhost.x == player.x-20 & cGhost.y == player.y)  are always true once you reach those coords. Since you never change the condition to become false, your animation will be caught repeating endless.
Try adding a SetAsPlayer=cGhost; after cGhost.LockView(5).
There are those who believe that life here began out there...

Snarky

Quote from: MugMan on Fri 09/12/2016 19:24:06
Should i be running this under something rather than execute always?

Yes! Almost certainly. What should trigger this happening?

MugMan

Quote from: Snarky on Fri 09/12/2016 20:31:25
Quote from: MugMan on Fri 09/12/2016 19:24:06
Should i be running this under something rather than execute always?

Yes! Almost certainly. What should trigger this happening?

The idea was that the player can posses other characters to use them, and i wanted to build a system that'd let the player switch back to the ghost anytime, so the ghost would walk next to the player, run a possesion animation and then change it's view into a weird orb thing

Snarky

OK, but what actually causes this to happen? The player clicks the cursor on the ghost, or what?

MugMan

Ah! I've solved the problem!

function cMan_Mode8()
{
cMan.SetAsPlayer();
Display ("You are now playing as ManMan");
bool Switching = true;

if (cGhost == player) {
}
else {
   
   if (Switching == true) {
   cGhost.Walk (player.x-20, player.y, eBlock); {
      if (Switching == true){
        Switching = false;

    cGhost.ChangeView(4);
    cGhost.Animate (0, 2, eOnce);
    cGhost.ChangeView(5);
          }

SMF spam blocked by CleanTalk