Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: mode7 on Wed 13/04/2011 10:56:23

Title: Animate objects in background and wait between animations
Post by: mode7 on Wed 13/04/2011 10:56:23
It sounds so trivial but somwhow i cant really figure it out.

I have some lightning in my backgrounds. It appears, animates. disappears and waits for a certain amount of time before it starts anew. While doing that I want the player to still be able to move around (all the time) so that if hes on a certain hostspot and lightning is visible i can trigger something.
It seems impossible or at least extremely complicated to do. Unless I'm missing somethin. do I?
Title: Re: Animate objects in background and wait between animations
Post by: Matti on Wed 13/04/2011 11:10:07
I don't get the problem. Why don't you use a timer?
Title: Re: Animate objects in background and wait between animations
Post by: mode7 on Wed 13/04/2011 11:46:20
^^
Thats what I did ^^
Sorry I need to get some sleep.

Here's how I solved it:

function room_RepExec()
{
  if (IsTimerExpired(2)) {
    ohigh1.Visible = true;
    oblitz1.Visible = true;
    oblitz1.Animate (0, 5, eOnce, eNoBlock);
    SetTimer(1, 20);
    SetTimer(2, 70);
  }
  if (IsTimerExpired(1)) {
    ohigh1.Visible = false;
    oblitz1.Visible = false;
  }
 
 
  //-----------------------------
  if (Hotspot.GetAtScreenXY (player.x,  player.y) == hblitz1 && oblitz1.Visible == true && Death == 0) {Death = 1;}
 
  //------------------------------

}

Title: Re: Animate objects in background and wait between animations
Post by: helios123 on Fri 15/04/2011 18:53:13
For lightning effects, the animating room background feature can also be used.  Just draw the lightning on the required background frames and adjust the animation speed. You can find it in the AGS manual under Animating background scenes.