Dynamic Object Reference (Wish List)

0 favourites
  • 8 posts
From the Asset Store
Create your quiz game! Create unlimited categories. Manage categories and questions
  • First Off... The work you've done with this is absolutely amazing... it took only 3 days of playing with this before deciding to buy a license Please don't stop the hard work.

    So on to the biggest thing that I feel would add incredible value as a seasoned developer the only thing I'm really missing is the ability to "dynamically reference an object" (not an instance but the object class its self) based on some sort of reference.

    I use functions religiously to reduce coding but any time I want create a method lets say to take an array and parse it into collection of a certain dictionary type (Create multiple instances of the same dictionary type) I have to create a function for every dictionary type and cannot create single function that passes the dictionary type I want to instantiate.


    <img src="http://i.imgur.com/lHEVGnc.png" border="0" />

    (I'm ambitiously attempting to build a multilayer game cross device)

    Please look at the image above. I call an Ajax method to get my player list. Now I can dynamically pass any list I want to the function but I cannot dynamically specify what dictionary type to load it to. I always have to hard code it meaning I have to copy and past this function for every dictionary type I want to create. As in the example above I'm generating my "Players" instances from the list my Ajax call receives.

    I would love if I could have just one function for this process instead having to recreate the same function and hard code the dictionary type I'm loading.

    Please let me know if your working on or will at some point work on making this available. I would love this feature more than words can describe and think others would as well.

    Thank you!

  • A much easier way to use multiple dictionaries is to put a dictionary in a container with a sprite. Then each sprite gets its own dictionary.

    You can pass a reference to an object by passing its UID to a function, then picking it back with the 'Pick by UID' condition. In recent builds 'Pick by UID' should run in approximately constant time.

  • Ashley

    Thank you for the prompt reply.

    This however doesn't solve my problem I don't think? If I put the dictionary in a sprite then I still have to hard code the specific sprite I want to access INSIDE the function.

    What I was hoping for was the ability that when ever I set an Event or an Action that looks for object (IE Event: "For each" or Action: "Create Object") that instead of being restricted to the list of objects in my project that I can also use a function parameter in this case i would pass the "Players" Object as a parameter to the function and be able to reference that parameter when defining an event or action inside the function.

    I could then call this function any time and pass it any Array and any Dictionary and it will take the Array and generate a dynamic number of instances of the Dictionary from it and load the corresponding values.

  • Well it looks like you're creating a dictionary per player, in which case putting it in a container with the player itself makes sense. You shouldn't need to hard code the object to use if you make use of families or UIDs.

  • Try Construct 3

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

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

    Thank you for pointing me in the right direction. I did finally solve it. Its not very attractive looking but it works. I hope someday you guy give us true dynamic object referencing but for now here is an example for anyone interested.

    <img src="http://i.imgur.com/NSEpYVR.png" border="0" />

  • Ashley

    I take it back... after adding more dictionaries to the Family I found that the "Create Object" method actually creates a new instance of EVERY object in the family and not just the one I had selected by UID. I cant seem to find a away around this.

    I have to always inside the function declare the object I want created removing my ability to re-use this function for other objects.

    Anyways... thanks for the help. I did learn more useful stuff but I would still like the ability to dynamically pass an object (not the instance but the object class it self) to a function and call the parameter in the Event/Action with in the function it was passed to.

    The complexity of games that can be achieved with this would be huge.... food for thought.

    Thanks again for all your hard work.

  • troublesum , try nickname plugin

  • vtrix

    You sir are my hero... Glad to see the community offering solutions as I know Ashley must be swamped with requests.

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