Select which member of family to create

Get help using Construct 2

Post » Mon Oct 08, 2012 8:49 am

Is there a way to select which member of a famility to create when using System:create?

Let's say I want to create a new enemy at runtime, but I want the enemy created to be randomly chosen in the family.

Do I have to create an event for each type of enemy in the family or is there a more practical option ?
B
5
S
1
G
1
Posts: 39
Reputation: 1,128

Post » Tue Oct 09, 2012 10:02 am

Hey sorry to bump this but I could really use an answer.

to Simplify my question, can you choose which object to create at runtime, at least in a family ?
B
5
S
1
G
1
Posts: 39
Reputation: 1,128

Post » Tue Oct 09, 2012 5:27 pm

When you create a family object at runtime it already randomly creates one object type from the family. If you want to create a specific object type in a family then just create that object type.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Tue Oct 09, 2012 6:05 pm

The thing is, I don't want to create an event for 50 types of enemies, meaning I wish something like this were possible:
system:create(typeOfEnemy)

instead of having to do:
if(typeOfEnemy == 1)
{
system:create(type1Enemy)
}
else if(typeOfEnemy == 2)
{
system:create(type2Enemy)
}
else if(etc)Kaisirak2012-10-09 18:05:45
B
5
S
1
G
1
Posts: 39
Reputation: 1,128

Post » Tue Oct 09, 2012 6:37 pm

You could try this plugin:
http://www.scirra.com/forum/plugin-nickname-behavior-nickname_topic57943.html

It allows for "create by name".
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Tue Oct 09, 2012 7:22 pm

Thank you, I'll give this a look
B
5
S
1
G
1
Posts: 39
Reputation: 1,128


Return to How do I....?

Who is online

Users browsing this forum: Rezzon71 and 20 guests