Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Secret Fawful on Mon 02/12/2013 23:07:16

Title: Game screen flashes black when clicking on GUIs (SOLVED)
Post by: Secret Fawful on Mon 02/12/2013 23:07:16
Anytime I click on a GUI in my game, the screen flashes black for a split second. This has not always happened. I've looked through all instances of ProcessClick, eMouseLeft, on_mouse_click, etc. that I can think of. I've deleted extra GUIs I was experimenting with. I've checked all of my modules' code. I can not, for the life of me, figure out what is causing this, or how to stop it. Any suggestions at all where to look or things to try? At first, I thought it was just my new iconbar doing it, but I tested the other GUIs, and they all do it.
Title: Re: Game screen flashes black when clicking on GUIs
Post by: on Tue 03/12/2013 12:14:57
Did you check in repeatedly_execute (in global script)? Just an idea, but things there that are looping can cause screen/GUI flashes from what I remember. Also check in your main game tab, what are GUI's doing when they're disabled, disappearing? Going gray? Cos if you have something set to turn off a GUI but your main game thing says "Always show" there might be some conflict? (though I can't think what myself).
Title: Re: Game screen flashes black when clicking on GUIs
Post by: Secret Fawful on Fri 06/12/2013 21:31:49
All of that stuff is working properly. Repeatedly_execute does not have any lines of code in it related to the GUIs. The GUIs are set to normally on. I still haven't found the root of the problem.
Title: Re: Game screen flashes black when clicking on GUIs
Post by: monkey0506 on Tue 10/12/2013 04:10:29
I was highly suspicious of your on_events. Turns out that calling FadeIn will actually set the screen to black and perform the fade-in, even without a prior (matching) call to FadeOut. You entirely foolish person, you forgot your braces. on_event is called every time the user clicks or releases the mouse over a GUI... haha

P.S. Warning to the wise:

Code (ags) Select
if (condition)
  player.PlaceOnWalkableArea();
  FadeIn(200);


Is exactly equivalent to:

Code (ags) Select
if (condition)
{
  player.PlaceOnWalkableArea();
}
FadeIn(200);


If you want to execute more than one line of code conditionally or as part of a loop, you must make sure you are using braces! ;)