SOLVED: Stipulate animated GUI's frame

Started by steptoe, Thu 09/08/2012 21:11:34

Previous topic - Next topic

steptoe

Hi

I'm not sure if you can stipulate a button's animated frames.

IE if frame 1 show this button else if frame 2 show this button.

All buttons are on an animated GUI.

Think along the lines of a radar picking up a signal at various locations of the radar.

Appear and then disappear depending on frame of gradar gui animation.

I'm trying this but it's not doing what i want:
Code: AGS
function Button12_OnClick(GUIControl *control, MouseButton button)
{
  gRadar.Visible=true;
  Button14.Animate(35, 0, 9, eRepeat);
  
  if(gRadar.Visible==true && Button14.Graphic==387)
  {
  Button16.Visible=false;
  Button15.Visible=true;
  
  }
  
  else if(gRadar.Visible==true && Button14.Graphic==383)
  {
  Button15.Visible=false;
  Button16.Visible=true;
  }
  }


Cheers


Khris

steptoe, you need to get a grip on the whole "which code goes where" issue.

The code you have posted isn't executed at all until the player actually clicks on the button. And even then, all this code is run exactly ONCE, which makes the if blocks kind of pointless, since a) you've just set the GUI gRadar to visible, so there's no way it isn't visible a few lines later, and b) the button image will always be the same, namely the first frame of the animation.

Code like this is obviously supposed to be executed all the time, and thus HAS to go in repeatedly_execute.

Think about giving orders to peons. Are they supposed to be doing it once, right now? Then put it in the current function. Or, do you rather want them to do something as soon as something else happens, at some point in the future? Then it has to go inside repeatedly_execute. It's as simple as that.

steptoe

#2
Hi Khris

I have now added this to repeatedly_execute_always and as you no doubt know, it works.
(I know, I know..... It just slipped my mind for a moment. That's old age for you  :P)
Code: AGS
}
  
  if(Button14.Graphic==387)
  {
  Button16.Visible=false;
  Button15.Visible=true;
  }
  
  else if(Button14.Graphic==383)
  {
  Button15.Visible=false;
  Button16.Visible=true;
  }

  }



cheers


SMF spam blocked by CleanTalk