Jibble

Author Topic: Map GUI set to pause game is not blocking hotspots behind it. [SOLVED]  (Read 527 times)

RetroJay

  • Posts: 537
  • Frankly, my dear, I'm a Kerbal and Proud of it.
    • RetroJay worked on a game that was nominated for an AGS Award!
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.
« Last Edit: 04 Aug 2014, 20:35 by RetroJay »
  Master Decorator

AnasAbdin

  • Posts: 2,920
  • Peace, Love and AGS
I'd do it by adding a little condition in the if statement...
Code: Adventure Game Studio
  1. if ( keycode == eKeySpace && gPlansMap.Visible == false )

RetroJay

  • Posts: 537
  • Frankly, my dear, I'm a Kerbal and Proud of it.
    • RetroJay worked on a game that was nominated for an AGS Award!
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: Adventure Game Studio
  1. 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.
  Master Decorator