How do I add or remove sprites from a Family during runtime?

0 favourites
  • 4 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • I have multiple families set up.

    I have my sprites part of multiple families, but I'm wondering if it's possible to add or remove the sprite from a family during run time.

    I've been looking all over the forums and the site, and I check the FAQ page and didn't find anything on it.

    Is it possible to change families during play?

    For an example, each of my families has specific functions. Named, AstarMovement etc...

    I might want to spawn a named tree that moves. So to do this, the tree must belong to both named and AstarMovement families. But if I want to change a tree that was just spawned with just Named to be able to move, I have to delete the first tree and replace it with one that's in both families. (I hope I'm explaining this right...)

    Is it possible to add or remove sprites from a family during play/runtime?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Families are an abstraction. You can't remove the 'familiness' at run time, but you can disable the behaviours, generally.

  • I'm assigning behaviors via families.

    So, in order to disable a behavior, I'd have to put each sprite into every single family that I have, and then disable the behavior I don't want. Based on the scenario.

    I'm trying to prevent Sprites with 500 behaviors, and instead have a sprite with 20 Families of behaviors.

    This way I could add or remove complex behaviors to any sprite, regardless of it's current set.

    I'm trying to do Entity Component stuff, but it's hard to figure out how to do it in Construct 2.

    Doing it the other way around would mean that I'd have to make one sprite with EVERY behavior and disable them all at start up, and then turn them on conditionally. I think that would be a mess.

  • C2 can't do that.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)