Odd behaviour or bug?

Get help using Construct 2

Post » Sat Jan 26, 2013 9:50 am

Hi could someone take a look at this and tell me whats going on.

The idea is to press space to bring up a selection and choose one of the sprites, let go of the space bar then click the left button to create your choice.

Two things are happening.

Selecting the first one works fine but when you click to select the next one the first one is created on the layer underneath.

The second problem is more puzzling to me. I can select sprites 1 - 4 in order and it does as i would expect, however selecting 4 first means i cant select any of the others.

If i change the code to select with the right button and create with the left then it works as expected.

I had hoped to create some sort of easy to access inventory using the left click only.

http://dl.dropbox.com/u/84974566/layers.capx
B
44
S
15
G
9
Posts: 1,096
Reputation: 11,013

Post » Sat Jan 26, 2013 2:52 pm

Here's how I'd do it:

sponge_inventory.capx (r116)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Jan 26, 2013 3:24 pm

Hey Nimtrix,

thats nice and neat, thanks

Not sure why mine didnt work though all the same.
B
44
S
15
G
9
Posts: 1,096
Reputation: 11,013

Post » Sat Jan 26, 2013 5:12 pm

Oh, I see what was happening now. If you select the 4 in your example, there's nothing stopping the "Create object 4" event from running, so every time you click a number it spawns an instance of 4. So when you're trying to select a number you select from the ones you spawned instead of the ones on the menu, does that make sense? It picks the 4 because it's the last event to run, so if there's a 4 under the menu, it'll pick that instead of the menu numbers.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Jan 26, 2013 5:25 pm

@Nimtrix, just wanted to drop in and say thanks for that simple but very effective idea. I've been toying with how to do popup dialogue boxes for a while and for some reason using layers never occurred to me.

So, thanks!
B
56
S
15
G
10
Posts: 910
Reputation: 11,942

Post » Sun Jan 27, 2013 10:37 am

Ha, i see now. makes sense really . Funny how easy it is to become blind to simple things.

Thanks
B
44
S
15
G
9
Posts: 1,096
Reputation: 11,013


Return to How do I....?

Who is online

Users browsing this forum: GUN, Yahoo [Bot] and 15 guests