Adding behaviors to families

Get help using Construct 2

Post » Wed May 28, 2014 3:26 pm

Hi.. I have a medium problem :) ... my game is based on 5 bugs to be eaten... for ex. on level 1 you need to eat 2 bugs #1, 2 bugs #2 and 2 bugs #2... Level 3, 2 of #1, 3 of #2, 4 of #3 and 3 of #4 ... so .. the more you go up in levels, more types of bugs you need to eat.. but always using those 5 bugs.. SOOOOO I decided to create 3 families of bugs.. one with bugs 1-3 .. one with bugs 1-4 and one with bugs 1-5.. I've added a bullet behavior to each families, so I can create them randomly.. The problem i am facing now is that even though the behaviors are applied only at the families, the bugs inherits of them... SOOO.. now bug #1 has 3 bullets behaviors!!! so you can just image the speed at which its coming at me!!!

the other options is to import the bugs 5 times, and make families out of unique bugs id, but i feel that this is not optimized to keep the game's bytes size low..

any thoughts?

thx

Marc.
B
7
S
1
Posts: 25
Reputation: 475

Post » Wed May 28, 2014 4:20 pm

you can set them to be disabled or enabled using events
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Wed May 28, 2014 4:29 pm

Only give the family that has ALL the bug types the behaviors you want them ALL to have. If the 1-5 family has the behavior, all the objects in the family have the behavior so adding the behavior to the 1-3 and 1-4 types is redundant. You would only use the lower level families to spawn the bugs while the higher family would do all the processing.
B
40
S
12
G
11
Posts: 331
Reputation: 7,752

Post » Wed May 28, 2014 8:47 pm

FragFather wrote:Only give the family that has ALL the bug types the behaviors you want them ALL to have. If the 1-5 family has the behavior, all the objects in the family have the behavior so adding the behavior to the 1-3 and 1-4 types is redundant. You would only use the lower level families to spawn the bugs while the higher family would do all the processing.



What he said ^^

Also I would like to add that you may only need 1 family for all of the bugs, then add/check for an instance variable to determine what type of bug it is :)
B
12
S
2
G
1
Posts: 26
Reputation: 835

Post » Thu May 29, 2014 6:27 pm

@ FragFather.. I don't think this will work for this extra reason I didn't mention.. the speed of the bullet is set randomly at the create object event... So I set for ex. family03.bulletSpeed to X ... if there is no behavior on the family I won't be able to do this won't I ? it would only work on family 5...

@ Bonesey.. I thought of that, but I thought that would slow down the system, since the bugs are generated randomly, I'd need to create a loop that would generate a bug, check it,s instance, then destroy it if it,s not in the range, then recrate one..!!!

@ Sgn15 ... are you talking about the families or the behaviors??? I tried to set the parameters of all the bullets to 0, then change it at the time of creation, that didn't work... If there is a way to disable the Behaviors, can you tell me how??

while writing, I thought of something along the lines of Bonesey... I can create events that would generate a random number from 0-2, 0-3 or 0-5 depending on the level, then use only 1 family with all 5 bugs and createObjectInstance X ... I think that could work!

thanks all for your inputs!!! greatly appreciated...
B
7
S
1
Posts: 25
Reputation: 475


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 22 guests