Problems with GUI?

I am having some trouble with my gui, there is a pause menu, it has three options(min menu, options, exit), so far i am working on options, basically when i switch , i have an animation where the main pause menu shrinks and the options menu is overlayed on top of the overlay scene, (does this cause issues?), i have a video here showing how it ends the game spontaneously for some reason after switching between the menus. https://drive.google.com/file/d/0B9SMh1EBaTriRkgzSHY5dHJjN0E/view?usp=sharing

Look like your clicking options then right before the options open up your mouse clicks the exit button… What you should do is have the button react only when you just released the mouse. At least that is what I think is happing.

How is your mouse click sensor set up?

If you want to ensure ‘just-released’ mouse clicks, you can change your script just a little:

change line 12:


click = cont.sensors[...

to


m = bge.logic.mouse
click = bge.logic.KX_INPUT_JUST_RELEASED == m.events[bge.events.LEFTMOUSE]

Then, change your test of click:


if click.positive:

to just


if click:

Noodle that to a mouse-over Mouse sensor, and it should run the script only when you mouse-over the button (no need for the mouse click sensor)

Thanks for the help guys, problem solved :smiley: