Are you interested in a fighting game tutorial?

Discussion and feedback on Construct 2

Post » Wed Jan 30, 2013 6:12 pm

@jayderyu @ErekT @Eisenhans @NotionGames @devMidgard @danny

Does any of you know how to create an instance and put it into a family during runtime? I also tried rex_rainbow Nickname plugin (create..and put into family...) but it is not working

I'm using C2 r116 64 bits
Image
B
42
S
11
G
5
Posts: 269
Reputation: 10,790

Post » Wed Jan 30, 2013 8:35 pm

You can't. Families are an edit time created component about shared behaviours and variables. if you need an object to have the behaviour before hand give them the values or put them in a family in edit time.

If you mention what your trying to achieve we might be able to offer some alternative solutions.
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Wed Jan 30, 2013 9:03 pm

for example creating KEN for family=P1 and family=P2. Since all the code interacts between families P1 and P2 (instead to the sprite object) no matter which character I select (Ryu, Ken, etc) I can use the same code and sprites.

If i cant achieve that I think I'll have to create all the charcters P1, then duplicate them for P2 and do the interactions between P1 and P2, for each P1 and P2

Imagine 10 characters, about 2 Mb of animations... 20 Mb
duplicating for P2... +20 Mb...... 40 Mb just in sprites

not to mention the hard work of coding
Image
B
42
S
11
G
5
Posts: 269
Reputation: 10,790

Post » Wed Jan 30, 2013 10:41 pm

Why do you need two families for that?
You could make text variable for family ie. "playerselect" and set it to Player1 or Player2 whenever you need to set character to specific player.

And to avoid code repetition You can use Function object - it's a life saver :)
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Thu Jan 31, 2013 1:22 am

danuyus. Would you be interested in joining me to make a smash brothers like game? PM me if you're interested.

I've got plenty of foundations set out, and ideas of how to make it work great on mobile with touch controls. I also found an artist. I'll tell you more in private though ;)
B
32
S
4
Posts: 405
Reputation: 3,219

Post » Thu Jan 31, 2013 1:30 am

Yes, im still interesed about this
B
95
S
25
G
20
Posts: 3,052
Reputation: 22,613

Post » Thu Jan 31, 2013 5:46 am

[QUOTE=shinkan] Why do you need two families for that?
You could make text variable for family ie. "playerselect" and set it to Player1 or Player2 whenever you need to set character to specific player.

And to avoid code repetition You can use Function object - it's a life saver :)[/QUOTE]

@shinkan I tried but didn't work

create sprite1 (which is already in the family)
set family.variable = 1
create sprite2 (also in the same family)
set family.variable = 2

but it affects both objects, not as it works for sprites or other objects with the same event above.
Image
B
42
S
11
G
5
Posts: 269
Reputation: 10,790

Post » Thu Jan 31, 2013 5:47 am

I'm giving up to the idea of duplicating the sprites since nothing so far is working
Image
B
42
S
11
G
5
Posts: 269
Reputation: 10,790

Post » Thu Jan 31, 2013 12:36 pm

example.capx

It would be much better if You could create objects by name in expressions... but still it's working fine.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Thu Jan 31, 2013 4:20 pm

@shinkan Hi, thanks very much, I think I'll give it a try but I'm having trouble picking instances.. specially for testing collisions and assigning vaues for variables because the code reference to the family, and when the condition is true it will pass the value to all members of the family
Image
B
42
S
11
G
5
Posts: 269
Reputation: 10,790

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: humanescape, Mirlas and 2 guests