Create Object with Families, how to control it?

0 favourites
  • 10 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello Everyone,

    I am testing the families, however I find something that I cannot resolve.

    I have a family with two objects inside Sprite1 & Sprite2.

    Then in my layout I added a button.

    In the event Sheet, I have.

    Button on Clicked: Create Object FamilyName   (with layer & position).

    Then I figured, that I cannot control wich object of the family will appear, for what I see is random.

    Is there a way to control this?

    I mean for example if I have two buttons, and the button1 is pressed create the sprite1 of the family.

    If the button2 is pressed create the sprite 2 of the family.

    I was thinking in a variable, but since I cannot give any value to the create object I discard that Idea.

    So any advice, recommendation ?

    Thanks in advance.

    Best Regards.

  • Instead of choosing the family in the 'Create object' action, just choose either Sprite1 or Sprite2.

  • Yeah I know that can be one solution, but the point is that I'm thinking how to do a fighting game.

    Layout 1: Character Selection.

    Click on a sprite which represent the character and load the follow layout.

    Layout 2: Gameplay

    This is the problem.

    Because if I have an sprite for every character (each one have its own animations) I will have like 40 repeated events, this is why I am trying to figure how to use it family.

    A more easy explanation of what I want to do (or trying to do):

    • In layout1 I have a variable "characterselected" which is number.

    So, in the next layout I would like to do something like:

    If characterselected=1 Load on layout the Sprite1

    If characterselected=2 Load on layout the Sprite2

    So, basically I am wondering if there is a way to this, without to repeat like 80 events...

    I was searching and it seems no one has made a fighting game :(

  • you will have to make a create action for every character you choose,

    so if characterselected=1 > create sprite 1

    and so on...

    once you have all that, because all sprites are in the family,

    they will inherit all other action and events that are on the family where they are in.

    like changing animation, you change animation of the family

    like collision , check for collision on the family

  • Unfortunaly this hasn't been implemented in C2 I had the same problem too. Let's hope someday they listen us and let us decide what will be spawned inside the family on creation like it was possible in C1.

  • Guif0DA what do you mean? have objects on runtime added to the family?

    not aware of anything that was in c1 and not in c2 dealing with families

  • Guif0DA what do you mean? have objects on runtime added to the family?

    not aware of anything that was in c1 and not in c2 dealing with families

    I mean the problem from the first post in the topic, the random creation of sprites inside family if u select to create the family. in C1 it was possible to control that so you could select exactly the object from a family u would want to by selecting create family.

  • I need this too.

    No fix yet?

    I think an extra field when selecting a family populated with the objects contained in that family, or an option to randomise them would be great.

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Instead of choosing the family in the 'Create object' action, just choose either Sprite1 or Sprite2.

    Help Ashley

    would have to have a new "create object", it would be used to create familys (uid or "string" or index);

    example: "create object" Family1 (index)

  • I think that you could create your character in other way. For example you could create or use (there is a nice plugin for this purpose in the scirra forums) a plugin to create objects from a family it some degree of dynamism.

    Lets suppose this:

    • ryu and ken belong to fighter family
    • player 1 chooses ryu and player 2 chooses ken
    • then you store the names of the charaters (ryu and ken) in some dictionary where the player 1 is key 1 and player 2 key 2 and the names stored are those of the characters
    • then you take both keys and its respective values and use (sorry I cant paste url but look for [Plugin] Nickname, [Behavior] Nickname in google with Construct 2 appended and you should find it) plugin to create your desired sprite accordingly, note that you will still have all the functionality for both sprites as defined in your family

    Hope it helps not quite sure since I might have not understood your purpose.

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