How to spawn only certain objects within family?

Not favoritedFavorited Favorited 0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • So we can't create sub-families, and I can't figure out how any kind of tagging system is supposed to work.

    I just have a family of enemies, and I want to be able to divide those into multiple tags (say, "blue" enemies and "red" enemies) and then spawn one of the tagged enemies randomly based on the given tag. But there is no basic tagging system on objects for some reason, and any instance variables have to be applied to the entire family to make tags appear for the pick by comparison event, but when you do that, it resets the instance variables to default any time something is spawned.

    I can't tell for the life of me how we are meant to do this.

  • It may be easier to combine similar enemies into a single sprite. Say, all blue enemies into blueEnemy sprite, all red into redEnemy sprite. This way you can create a blueEnemy instance and then pick a random animation for it.

    Alternatively, you can create a random enemy using "Create by name" action. For example:

    Create object by name: choose("blueSkeleton", "blueZombie", "blueGoblin")

  • It may be easier to combine similar enemies into a single sprite. Say, all blue enemies into blueEnemy sprite, all red into redEnemy sprite. This way you can create a blueEnemy instance and then pick a random animation for it.

    Alternatively, you can create a random enemy using "Create by name" action. For example:

    Create object by name: choose("blueSkeleton", "blueZombie", "blueGoblin")

    Thanks for this tip! I realized families inherit to other families though so I just made a bunch of mini-families. So I have "Enemy" family, and then "Red" family with all red enemies in it, etc. Then instead of spawning from Enemy family I pick the specific group I want to spawn from.

    Definitely a little weird to get my head around coming from other workflows like Unity but it does get the job done.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, right, objects can be in multiple families. Your solution is better!

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