Still clicking on sprites that were destroyed.

Get help using Construct 2

Post » Tue Oct 30, 2012 12:18 pm

All right, this is my first post on the forums, so I hope I can explain my situation clearly.

First off, it's a mobile game, so I have 'touch' on, but I'm testing it on my browser with my mouse.

I'm making a sort of 'pop-up' menu. As in, when you click on a sprite in a lower layer, a menu appears on a higher layer (a square sprite is created with other 'icon' sprites over it), where you can click on one of the sprites from the 'pop-up' menu (changing a variable and destroying the pop-up menu sprites - restoring the screen).

Here's the trouble.

I was hoping that placing the 'pop-up menu' sprites in higher layers would be enough so that you wouldn't be able to click on the bottom layer 'sprites'.
Apparently, I can still click on sprites from layers that, although aren't visible, are still below the pop-up menu (which I obviously don't want).
Another problem (which is even stranger) is that when the pop-up menu is not even created yet, I can already click on its sprites. As in, I click on where the sprite would be created (in the pop-up menu) and it automatically selects it without even opening the pop-up menu (or possibly creating and destroying in the same click).

Thank you all for your help. I'm constantly visiting the forums when I have doubts and have always found the answer. I just haven't found anything on this yet.
Posts: 2
Reputation: 654

Post » Tue Oct 30, 2012 2:28 pm

Hi Yarasmodai,

I got round this problem by having a family with all the buttons which makes the menu open, then have another family with all the buttons to close the menu. On the close menu family I set the position of the menu to be outside of the layout like -50x and -50y(so it cant be seen) and on the open menu family it sets the menu to the position where you want.
There may be a better way to do it, but this should work.

Hope this helps.
Posts: 51
Reputation: 18,702

Post » Tue Oct 30, 2012 6:48 pm

Thanks for the help, RockmanZero! Haven't used families till now, so it was a good way to get introduced.

Unfortunately it did not fix the problem (although I kept it the way you described because I think it's probably more useful).

I did ended up fixing it by playing around with it (not even sure how).
Here's what I did:
At first I had it so that when you clicked on a sprite it would destroy/move certain sprites and create others.
What I did now is that when you click on the sprite a global variable is set to X.
Below I set it up as 'in every tick', if global variable is X ---> move the sprites to their specific position (inside or outside the screen).
I did different setups for the different pop-up menus, that are now determined by the same global variable.
Not sure why it works, but it does.

Again, I hope I'm making myself clear. Not used to using the lingo yet.Yarasmodai2012-10-30 18:49:54
Posts: 2
Reputation: 654

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests