Object animation on conditions problem

Started by steptoe, Wed 28/12/2011 10:59:55

Previous topic - Next topic

steptoe

Hi

This is rather an embarrassing problem.

Conditions are not running as they should.

When ocup1 &&  ocup2 && ocup3 become !visible  (through PPCollision) object[19] becomes visible there is NO animation running for it.

The view for object [19 ] is 100% perfect and the objects correctly named and are all on walkable areas.

The idea is for object[19] to flash continuously when condition have been met.


This is not working as it should even though object[19] becomes visible.
Code: ags


function repeatedly_execute_always()
{
   if (!ocup1.Visible && !ocup2.Visible && !ocup3.Visible)
  
{ 
  object[19].Visible=true;
  object[19].SetView(14, 0, 0);
  object[19].Animate(0, 5, eRepeat, eNoBlock, eForwards);
 
}
}


This however makes object[19]visible once ocup1 && ocup2 become !visible and when ocup3 is !visible the animation works.

Code: ags

function repeatedly_execute_always()
{
   if (!ocup1.Visible && !ocup2.Visible && ocup3.Visible)
  
{ 
  object[19].Visible=true;
  object[19].SetView(14, 0, 0);
  object[19].Animate(0, 5, eRepeat, eNoBlock, eForwards);
 
}
}


Can you see an error of have an explaination for this?

cheers for any help on such a somewhat  simple matter

steptoe



It's not over until the fat lady sings..

Khris

Once the condition is met, you're telling the object to start its animation over and over again, preventing it from ever actually starting to animate.

Code: ags
function repeatedly_execute_always()
{
  if (!ocup1.Visible && !ocup2.Visible && !ocup3.Visible && Game.DoOnceOnly("startobject19"))
  { 
    object[19].Visible=true;
    object[19].SetView(14, 0, 0);
    object[19].Animate(0, 5, eRepeat, eNoBlock, eForwards);
  }
}


This should work that way because AGS evaluates the condition from left to right so Game.DoOnceOnly isn't called up until all ocup objects are invisible. If it still doesn't work, put Game.DoOnlyOnly in a separate if block inside the other one.

Also, use proper fucking indentation. AGS fucking does it automatically every time you press Return.

steptoe

#2
I should have guessed DoOnceOnly

Quote
Also, use proper fucking indentation. AGS fucking does it automatically every time you press Return.

When I press return after a line the cursor just drops to space underneath.

Thanks Khris

cheers



It's not over until the fat lady sings..

Khris

Quote from: steptoe on Wed 28/12/2011 11:29:48When I press return after a line the cursor just drops to space underneath.
Try typing a { or } then return and see what happens.

But even if AGS didn't help you and only kept the current indentation, what's keeping you from doing it manually?
I don't really care how you indent your code. Until you post it here to get help. It's just common courtesy.

steptoe

It's not over until the fat lady sings..

SMF spam blocked by CleanTalk