[HOW TO] Creating the right sprite inside family

0 favourites
  • 4 posts
From the Asset Store
Awardkit
$5 USD
Create custom awards and achievement or use the many templates and create your own.
  • Hey

    I've got a question.. can I create a specific sprite inside a family using system create object and selecting the family as object???

    I'm trying that for a few time and to be honest I have no idea if it's possible..

    I thought that adding some condition that specify a sprite inside the family would solve the problem but it just creates random sprites from the family when the object is created.

    Any ideas??

    here's a simple capx:

    dl.dropbox.com/u/71080256/testing.capx

  • Why not just select the object you want to create instead of the family?

    Edit: if you're trying to create an object by its name, use a series of subevents, e.g.

    if name = "obj1", create sprite1

    if name = "obj2", create sprite 2

    ...etc

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley

    If I were to create a level editor, I would probably put all the game object in a family "gameObjects" and I would appreciate to be able to browse an array of indexes and do something like

    Global cols = 10
    Global rows = 10
    Global cellSize = 32
    +System: for "" from 0 to cols*rows-1
      Local x = 0
      Local y = 0
      -> System: Set x to loopindex%cols
      -> System: Set y to floor(loopindex/cols)
      -> System: Create gameObjects[Array.At(x,y)] on Layer "Game" at (x*cellSize,y*cellSize)

    using in short family[id] to access a specific member of a family.

    It would then be also interesting to be able to sort the members or assign specific ID in a family to keep consistency if I were to add gameObject to my level editor.

    For now the only way to achieve the same result is to make an event per gameObject which is a bit ugly :D

  • Why not just select the object you want to create instead of the family?

    Edit: if you're trying to create an object by its name, use a series of subevents, e.g.

    if name = "obj1", create sprite1

    if name = "obj2", create sprite 2

    ...etc

    I'm sorry, but this isn't the solution that I'm looking for, my intention is optimize the gamecode. Imagine if in the family there's 100 sprites, would have to add 100 events just like the one you mentioned.

    You say: Why not just select the object you want to create instead of the family?

    Then I say: Why not with families?

    As Yann mentioned, for game level editors and many other things, this will be very helpful if it's possible.

    In construct 1 I can do what Yann mentioned. Can't Construct 2 be able to do that too?

    I've also made many suggestions on another topic that the only purpose is to make the Construct2 tool more powerful in the issue of expanding the possibilities of game creation.

    Please understand that I'm just giving new ideas for C2 that are already possible to do in Construct1.

    If these things will in the future be implemented in C2 then it's okay, I know that take time and also there's priorities sometimes.

    ps:sorry for my english ;)

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