Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: RetroJay on Mon 04/08/2014 19:44:39

Title: Map GUI set to pause game is not blocking hotspots behind it. [SOLVED]
Post by: RetroJay on Mon 04/08/2014 19:44:39
Hi all good peeps.

Here is my problem.
I have set my game to use keys only.
All was going splendidly until I wanted to implement a Plans/Map gui, with the push of the P key.
The Plans/Map gui is a full screen gui and set to 'pause game when shown'.
This all works fine, the Plans/Map gui turns on and off with the push of P and the game pauses/un-pauses when this happens.

However...
On my game screen I have hotspots and have set the 'Space key' to examine these spots.
I only found out the other night, by chance, that if the player character happens to be over a hotspot when the Plans/Map gui is displayed, pushing the space key still operates behind the gui and locks the entire game.
Obviously I don't want this to happen but don't quite know how to rectify this

Could someone please help me with this small but exceedingly irritating problem.

Yours.
Jay.
Title: Re: Map GUI set to pause game is not blocking hotspots behind it.
Post by: AnasAbdin on Mon 04/08/2014 19:51:14
I'd do it by adding a little condition in the if statement...
Code (ags) Select
if ( keycode == eKeySpace && gPlansMap.Visible == false )
Title: Re: Map GUI set to pause game is not blocking hotspots behind it.
Post by: RetroJay on Mon 04/08/2014 20:35:30
Hi AnasAbdin.

Absolutely fantastic.
Thank you ever so much for that, it works like a charm.

I did have to change it slightly as my game would not compile.
Code (ags) Select
if (IsKeyPressed(eKeySpace) && gMansion_Map.Visible == false )

I have put this at the beginning of my hotspot and region scripts.
I tried it in 'on_key_press' to see if I could get it to run globally but it didn't want to know.

Anyway, thank you for your help, much appreciated.

Yours.
Jay.