Pick ID und destroy after spawn

Get help using Construct 2

Post » Mon Feb 16, 2015 12:08 pm

Hi

Simply cant figure out what I am doing wrong here

After af spawns of a family with 4 diff sprites ( Slice1,Slice2,Slice3,Slice4)
I pick the ID for Slice1

This works fine since I can set its opacity and spawn the Blocker
BUT when I want to destroy it goes wrong

Any Idears :-)

C2_pick-instance2.jpg
You do not have the required permissions to view the files attached to this post.
B
27
S
15
G
10
Posts: 337
Reputation: 7,810

Post » Mon Feb 16, 2015 12:13 pm

From the manual..

Index IDs (IIDs)

All objects at runtime have an index ID assigned, which is the number of the instance within its own object type. It is returned by the object's IID expression. For example, the first instance in two object types both have the IID 0, the second 1, and so on. Therefore the IID neither identifies a unique instance like the UID, nor does it persistently refer to the same instance (if IID 0 is destroyed, the next instance becomes IID 0). However, it can be useful for advanced users taking advantage of object expression indexing and the Pick Nth instance system condition.

Maybe try using instance variables instead..
B
46
S
16
G
9
Posts: 1,096
Reputation: 11,153

Post » Mon Feb 16, 2015 12:51 pm

Thanks
... well getting a bit advanced for me

How else could I pick 2 > Slice1 > spawn the blocker and destroy the 2 Slice1
B
27
S
15
G
10
Posts: 337
Reputation: 7,810

Post » Mon Feb 16, 2015 2:04 pm

The problem is that you're doing that every tick. On tick 1 it destroys two sprites. On tick 2 it destroys two more... etc. You need to add a condition to make that event only run one time.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,150

Post » Mon Feb 16, 2015 2:14 pm

Understanding picking with respect to Families
Tutorial written by cacotigon
Originally published on 10th, May 2013
https://www.scirra.com/tutorials/556/un ... o-families
B
218
S
30
G
14
Posts: 1,890
Reputation: 37,596


Return to How do I....?

Who is online

Users browsing this forum: anty21ro, lamar, ruannmelgaco, Vavacav and 1 guest