[Request] List/Array/Table Behavior

0 favourites
  • 12 posts
From the Asset Store
2D Tile Set
$2.99 USD
Tile map for your 2d platformer games, custom sets available on request
  • Hello fellas,

    • should be possible to store data in a multi dimensional array (or list, hashtable etc) within an instance of an object.
    • similar to a local variable of the object instance, but with array/list functionalities like push, pop, sort, iterate etc.
    • actually it could work if the official array object could be used as a behavior.

    I would use it a lot.

  • You can do this with a container. Add an Array object, select your parent object, Create a container in the GUI, add the Array. That array will automatically be created and picked with the parent.

  • gonna try that approach. I think a separate behavor would be more intuitive to use.

  • Ok, it works, but with many limitations.

    1st issue - you can't add container to a family, what means if I have multiple sprite objects in the family which should share the same functionality (e.g. an array) i have to create a separate array object for each individual sprite object, because it's not possible with the family.

    2nd issue one and the same object type can't be shared by different containers, which is very limiting

    Actually it would be nice, if more modularity features would be added to C2, like proper working container with hierarchies and object blue-prints (groups of behaviors and object types).

  • I am trying to make taffydb plugin recently. Hope it would be useful.

  • rexrainbow sounds great. So it will be possible to store list data inside objects and do all sort of queries with that? Or it will be a mini-database inside an object?

  • Why not instance variables with JSON in?

    You can try my prototype: Plugin

    Looks more complicated than it is.

    I manage complicated dictionaries with it.

    You can do:

    Add instance variable to instance, for example myobj set it default "{}"

    instance.myobj = DirectData.SetToObject(object.myobj,"firstpath,secondpath","hello")

    or something like

    instance.myobj = DirectData.SetToObject(object.myobj,"firstpath","{""secondpath"":""hello""}")

    ------------------------------------

    But yes, I will anyway adopt it to a behavior.

  • So, I added a behavior.

    Works like the plugin...

    I add infos later.

    Now for this its easier:

    instance.DirectData.Set("firstpath,secondpath","hello")

    or

    instance.DirectData.Set("firstpath","{""secondpath"":""hello""}")

    ------------------------------------

    Sort I have never needed, will look for it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • deathangel1479 Thanks, that's a solution.

  • xoros

    If your requirement is a multiple dimension dictionary only, you might try Yann's JSON plugin, and put instance's uid at first level key.

    For example

    root

    • uid:1

    -- hp: 100

    -- mp:60

    • uid:2

    -- hp: 20

    -- mp: 7

    And remove dictionary of uid while instance had been destroyed.

    If you need querying, you might wait for my database plugin. It is also a multiple dimension dictionary, too.

  • that will do as well, but my point was just to have a simple array functionality inside an instance of the object.

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