Nested conditions for Pick UID not working

Get help using Construct 2

Post » Tue Feb 12, 2013 9:16 am

Hi,

I have some conditions that are nested under a sprite destroy trigger. The conditions are testing if the sprite being destroyed is on the edge of the game board (if so do nothing) and picking an instance of the sprite by UID stored in the game board array (array's UID are correct).

I can't seem to make this work, I have tried all sorts: placing them under different branches (On kill, On animation finish), having Pick UID as subevent, not having the edge tests, and also tried using Pick nearest.



Any help is much appreciated.
B
24
S
11
G
5
Posts: 140
Reputation: 5,004

Post » Tue Feb 12, 2013 11:31 am

How events work
After an event ends, the next event begins from scratch. Its conditions will start picking from all instances again.
On the other hand, sub-events (which appear indented) carry on from where its parent event left off. A sub-event will further filter the instances left over by the event that came before it.


Your event is targeting a single Sprite, the one being destroyed, that's why the sub-events can't find any other...
For example, you could add a System action "Pick all", to get all the Number sprites, before choosing one from its ID.
B
20
S
5
G
8
Posts: 325
Reputation: 6,473

Post » Tue Feb 12, 2013 12:16 pm

Still not getting anywhere with Nesting the conditions under a Pick All.

I have also tried to assign the X/Y cords to a variable.

B
24
S
11
G
5
Posts: 140
Reputation: 5,004

Post » Tue Feb 12, 2013 12:47 pm

Yeah in your last screenshot, Pick all is being negated by the subsequent Is animation "Destroy" playing
Pick all should be right before Pick instance with UID
B
20
S
5
G
8
Posts: 325
Reputation: 6,473

Post » Tue Feb 12, 2013 1:26 pm

Really struggling to grasp this, thought I had Events and Variable/Instance Scoping understood but obviously not!

I have tried to put a Pick All just before Pick with UID (as another condition and as parent/sub-event). Just to be clear I don't want to pick all instances, I just need the ones either side of parent.

Below is a stripped down .capx (makes it smaller/easier to find events), wont compile but just so you could possibly position the events correctly for me cheeky I know but this is getting frustrating.

https://dl.dropbox.com/u/2175584/Construct2Examples/NestedPickAll.capx
B
24
S
11
G
5
Posts: 140
Reputation: 5,004

Post » Tue Feb 12, 2013 2:31 pm

Do forget to strip down the plugins as well next time, I had to install 3 of them

Anyway, what you did looks fine to me. If your target instance has indeed this "destroy" animation playing, I guess it's ok with just one "Pick all" at the top like you first did. But there's no way to test the export so I made another example that I can confirm to work...

PickAll.capx
Hopefully that helpslemo2013-02-19 06:22:30
B
20
S
5
G
8
Posts: 325
Reputation: 6,473

Post » Tue Feb 12, 2013 5:04 pm

Thank you for your help, I actually ended up doing this with a Function as your method wasn't giving me the results I needed. Should have done it from the start :(

B
24
S
11
G
5
Posts: 140
Reputation: 5,004


Return to How do I....?

Who is online

Users browsing this forum: h1k3, LeFuji and 18 guests