Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Wed 16/07/2014 19:56:16

Title: SOLVED: Stopping function
Post by: Slasher on Wed 16/07/2014 19:56:16
Hi,

I am creating a game status report and have hit a snag.

I need to stop a function....

This is the function:

Code (ags) Select

int walktimer;

function Walking()
{
    if(player.Moving)
      {
          walktimer=0;
      } 
    else if (walktimer > GetGameSpeed ())
      {
          Stopped_Moving += 1;
          LNotMoving.Text = String.Format("%d", Stopped_Moving);
          walktimer = 0;
      }
    else walktimer++;
}



In Rep exec always:

Code (ags) Select

  LDoors.Text = String.Format("%d", Doors);
  Larrows.Text = String.Format("%d", Arrows);
  LNotMoving.Text = String.Format("%d",Stopped_Moving);
  LSecrets.Text = String.Format("%d",Secret_Area);
  LRemain.Text = String.Format("%d",lapsed);
  LTime_Taken.Text = String.Format("%d",lapsed);
  LLostTime.Text = String.Format("%d",Stopped_Moving);
  LMeanTime.Text = String.Format("%d",lapsed-Stopped_Moving);
  Walking(); // This is the function I need to stop when viewing the status report... The gui is set to pause game.


Can you help..

cheers

EDIT Tut tut... added this:

Code (ags) Select
if(gStatus.Visible==false)
  Walking();
 


All now ok (nod)



Title: Re: Stopping function
Post by: Khris on Wed 16/07/2014 20:04:17
Are you asking for
Code (ags) Select
  if (!gStatus.Visible) Walking();
?

Edit: Yeah. How long did you try and fix this yourself before opening a thread...? :P
Title: Re: SOLVED: Stopping function
Post by: Slasher on Wed 16/07/2014 20:08:26
Hi Khris,

about 2 minutes as I had only just began implementing it... It suddenly dawned on me what I needed to do...