[SOLVED]Hide and Show for objects

In the Geometry Monster tutorial you end up making a button called “Main Menu” which is basically a sprite object with 3 states, normal, hover (where it’s highlighted) and pressed. When you hit it with the mouse it calls the “change scene” action. This is fine except mouse clicks for the button were still being read on the main menu screen. So when you pressed the main menu button, I had it hide the main menu and try again buttons. I had the same problem on the main menu screen. I would switch to “Level 1” and it kept restarting the game, until I hid the “Start” (sprite object) button. So I take it Show and Hide pertain to actual usage of the object as well? Is this the normal way to do it?

Is this correct?

The Show/Hide action by itself only makes an object visible/invisible. While hidden/invisible, it is still actually there and can be interacted with as you would if it were visible.

1 Like

Just to add to what beanmatt wrote: you can limit the interaction (for example clicking an invisible button), if you use the condition “object is visible”.

image

Note, those actions after the Change Scene will not get run.

beanmatt
The Show/Hide action by itself only makes an object visible/invisible. While hidden/invisible, it is still actually there and can be interacted with as you would if it were visible.

And yet it still works, don’t know why then.

Drona
Just to add to what beanmatt wrote: you can limit the interaction (for example clicking an invisible button), if you use the condition “object is visible”.

Noted.

MrMen
image
Note, those actions after the Change Scene will not get run.

Still seemed to work, and I don’t know why, although I moved the change scene line to the end in my level 1 events tab

UPDATE: It still didn’t work, and you’re right the buttons are still active. I think that’s something that should be addressed as a bug. When you switch scenes it should automatically disregard any scripts or objects in the other scene. I guess it means I literally need to delete all objects before changing a scene.

Does anyone know if you could do a for-each on every object in a group, but also delete that object? Or would this screw up because it’s going through them?

Well here goes another one that’s my fault. I guess it wasn’t sprite objects/buttons from the other scene, it’s just I didn’t disable them in this scene.