Sliding GUI code question: - SOLVED

Started by Fritos, Thu 15/07/2004 13:41:51

Previous topic - Next topic

Fritos

Where would I put this in my global script? When I put it under my repeatedly_execute. My game just sits there in wait mode. And how would I get it to roll back up once the mouse leaves the GUI area?

Code: ags

SetGUIPosition(5, 0, 199);
GUIOn(5);
int y=200;
while (y>180){
y--;
SetGUIPosition(5, 0, y);
Wait(1);}


Thanks for your assistance!

Radiant

Well, that depends on what you want to do with it. If you put this in repeatedly_execute, it will be (guess what) repeteadly executed. I.e. continuously, the GUI should move up and snap back down.
You'll probably want the GUI to come up when you click somewhere (put it in on_mouse_click), or click on a gui button (put it in interface_click) or press escape (put it in on_key_press).
Or maybe when you move the mouse below y=180, in which case you should do something like
Code: ags

(in repeatedly_ex)
if (IsGUIOn (5) == 0 && mouse.y > 180) {
  GUIOn (5);
  // you code here to move it on-screen
}
if (IsGUIOn (5) && mouse.y < 180) {
  // move GUI back off-screen
  GUIOff (5);
}


Fritos

Thanks for the prompt reply Radiant. Speaking of, I was just looking at your KQ 2 1/2, and liked the effect you did with your GUI. So I wanted to see what it would look like on mine.

Fritos

#3
So I got everything to roll up and down, but now when I have other GUI's up and move the cursor into the bounds of my main GUI it slides back into view, even when it is turned off.

I thought only one GUI can be processed at any given time and it would only acknowledge mouse bounds within the GUI. Kinda confused?

Fritos

I figured it out:

In the repeadly_execute code that you supplied, I also had it check to make sure that if any other GUI was on, it wouldn't intiate the code to slide the main gui into view.

Thanks again for you assistance, Radiant!

SMF spam blocked by CleanTalk