Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: markbilly on Sun 18/03/2007 18:10:01

Title: ShakeScreenBackground at timed intervals (SOLVED)
Post by: markbilly on Sun 18/03/2007 18:10:01
If this should be in beginners then I apologise.

I need to be able to run the ShakeScreenBackground at intervals of 30 seconds. At the moment I can only run it constantly in repeatedly_execute_always().

Something like would work:

ShakeScreenBackground(blah, 0);
Wait(500); (but without pausing the game or blocking)
ShakeScreenBackground(blah);

Thanks in advance.
Title: Re: ShakeScreenBackground at timed intervals.
Post by: GarageGothic on Sun 18/03/2007 18:19:46
You just need to code a simple timer:

In the top of your script:
int shaketimer;

in repeatedly_execute_always

if (IsGamePaused == 0) { //you probably don't want the screen shaking while in the save menu etc.
   if (shaketimer > 500) {
      ShakeScreenBackground (4, 10, 80); // or whatever
      shaketimer = 0;
      }
   shaketimer++;   
   }
Title: Re: ShakeScreenBackground at timed intervals.
Post by: markbilly on Sun 18/03/2007 18:36:10
That's perfect thanks :)