Checking if objects were selected

Get help using Construct 2

Post » Sat Jun 03, 2017 9:17 pm

Trying to get c2 to react if specific objects of a certain type have been clicked or targeted. This is what I'm trying atm.
Image
Right now it isn't creating Sprite2, but when the create object command is placed above, in id = 1, it seems to work, making me think it's not progressing to the next id = 2, id = 3 conditions.
Any other ways this can be done? In the above, I'm trying to create Sprite2 when Sprite id's 1, 2 and 3 have been clicked.
B
12
S
2
Posts: 12
Reputation: 774

Post » Sat Jun 03, 2017 9:32 pm

Lets breakdown event 3 (and further) down.

The 'Every tick' is not needed.

The conditions read as follow ....

'For each' runs trough every Sprite. Each run it picks 1 Sprite.
So at any point in the iteration, the picklist now contains 1 Sprite.

Event 4 starts picking from that (previous picked) picklist.
It picks from that picklist all sprites with id = 1 and clicked = 1.
The result is a new (refined) picklist. If that new picklist is empty, the conditions marks as untrue, and will not run its sub events, it will not run its actions.

Lets assume that this new piclist is not empty at one point in the iteration.
Or, lets assume that there is a Sprite with id = 1 AND clicked = 1.

Now event 5 start picking from the (previous picked) picklist (in event 4).
That previous picked list can only contain Sprites with id = 1. No others. Hence event 5 can never ever pick a Sprite with id =2 from a list that only contains Sprites with id = 1.
Event 5 will never ever run, its picklist is always empty.

Event 6 is a sub. Not only has it the same problem. It is also a sub under event 5. Since event 5 can never ever run, event 6 is never ever reached.

Plz read this:
https://www.scirra.com/manual/75/how-events-work
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sun Jun 04, 2017 12:29 am

99Instances2Go wrote:


Ah thanks, I see!
B
12
S
2
Posts: 12
Reputation: 774


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests