How do I spawn a certain object with within a family

Get help using Construct 2

Post » Fri May 23, 2014 1:25 pm

Hi everyone,

I've had some trouble with spawning certain objects from families based on the value of global or array variables.

I've got a family with roughly 10 objects in it. Each object type has a unique family instance variable called "ObjectNumber". I want to spawn only the object within this family which has 'ObjectNumber = X' where is X is a global variable or an array value.

So far I've been trying out code similar to this:
CONDITION:
Family, ObjectNumber = X

ACTION:
System, Create object Family on layer 0 at (0, 0)

And many many versions of the above using picking, for each loops etc.

I know I could use if statements and write the code out separately with a separate spawn action for each value of X but it makes the code long and makes it time consuming to make small changes to the code.

Anyone have any idea where I'm going wrong?
Mega Game Studios is a tiny independent game studio run from our apartment in Melbourne, Australia. We're not quite sure what we do yet but we think it has something to do with apps, board games and plush toys.

www.megagamestudios.com
B
18
S
7
G
3
Posts: 85
Reputation: 2,920

Post » Fri May 23, 2014 1:36 pm

What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Sat May 24, 2014 4:34 pm

Hi Granpa,

I had a look and that should fix all my problems.

Thanks for that!
Mega Game Studios is a tiny independent game studio run from our apartment in Melbourne, Australia. We're not quite sure what we do yet but we think it has something to do with apps, board games and plush toys.

www.megagamestudios.com
B
18
S
7
G
3
Posts: 85
Reputation: 2,920


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests