0 Favourites

Adding behaviors to families

  • 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.

  • you can set them to be disabled or enabled using events

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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

  • 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...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
[BEHAVIOR] Chipmunk Physics
673 82,496
nelostic's avatar
nelostic
Unread hot topic
0 Favourites
[Behavior] LiteTween
672 169,873
manujorgo's avatar
manujorgo
Unread hot topic
564 105,208
rexrainbow's avatar
rexrainbow