How can I create a given object from a family

0 favourites
  • 4 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hi everyone,

    In C2 I was using the Nickname plug-in to do that, but I'm wondering if in C3 it's possible to do it without any plug-in.

    I would like to create a given object type from a family.

    For example, I have a family "Enemies" in which there are 3 object types named "enemy1", "enemy2" and "enemy3". The family "Enemies" has a family instance variable "enemyNumber" set respectively to 1, 2 and 3.

    If I create an instance of Enemies, how can I set it to be enemy1, enemy2 or enemy3 (based on the "enemyNumber" instance variable) instead of a random instance of Enemies?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Construct 3 added the "Create object (by name)" action that could be useful for that.

  • in my game I create multiple different types of enemy on the fly using a "create enemy" function

    the function has a parameter 0 (or whatever) relating to enemy type

    so the function is

    on function "create enemy"

    para0=1 then create enemy 1

    para0=2 then create enemy 2

    para0=3 then create enemy 3 etc.

    so in game

    call function create enemy (1) = makes enemy 1

    call function create enemy (2) = makes enemy 2 etc.

  • Thanks a lot!

    Create object by name was what I was looking for.

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