Objects visible - Off & On with no wait

Started by Ghostlady, Sun 09/04/2006 00:30:09

Previous topic - Next topic

Ghostlady

I am working on a puzzle that turns objects off and on.Ã,  The object is to click on the object while it is on.Ã,  The problem is I have to put a "Wait" in the script between the turning off and on of objects otherwise you won't see them turn off and on.Ã,  With the "Wait", it stops other scripts from running so now the object is unclickable.Ã,  Any ideas?
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven
Haunting at Cliffhouse

Ashen

Use Timers, maybe? Set the timer when you turn the object on, and turn the object off again when the timer expires, something like:
Code: ags

//Wherever you turn the Object on
object[0].Visible = true;
SetTimer (1,40);

// Repeatedly_Execute
if (IsTimerExpired(1)) object[0].Visible = false;

Check the manual for more detail on SetTimer & IsTimerExpired

You could also use the Timer to turn the object back on again:
Code: ags

if (IsTimerExpired(1)) {
  if (object[0].Visible == false) object[0].Visible = true;
  else object[0].Visible = false;
  SetTimer(1,40);
}
I know what you're thinking ... Don't think that.

Ghostlady

The timer worked.Ã,  Brilliant.Ã,  I learn something new everytime I come here.Ã,  Thanks AGAIN Ashen.Ã,  :)
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven
Haunting at Cliffhouse

SMF spam blocked by CleanTalk