Animate objects in background and wait between animations

Started by mode7, Wed 13/04/2011 10:56:23

Previous topic - Next topic

mode7

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?

Matti

I don't get the problem. Why don't you use a timer?

mode7

^^
Thats what I did ^^
Sorry I need to get some sleep.

Here's how I solved it:
Code: ags

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;}
  
  //------------------------------

}


helios123

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.
That's all for now,
helios123

SMF spam blocked by CleanTalk