How do I Select between multiple instances of a JSON Object?

0 favourites
  • 3 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hey There!

    I'm currently in a project where i'm using a JSON object as mean of storing data about a Sprite Object's history. Whenever a create a new instance of this Sprite Object i also create a new instance of the JSON Object and store the Sprite.UID on an instance variable in the JSON Object, so i can find which JSON Instance belongs to each Sprite.

    The thing is, I can't seem to pick the JSON instance with "Pick By Comparison" where i search for a JSON where the instance variable = Sprite.UID, but whenever i use this condition the EventBlock wont run.

    I'm not really sure i should be creating multiple instances of a JSON object, but i can't see why not... Should i be doing it some other way? Is there a right way to do this?

    Thanks in advance

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Could you just store all the Sprites' object histories in a dictionary?

    The key would be the sprite's UID and the value would be the sprite's JSON data

  • make the sprite a container, and add the json object to the container. Then the json object will be automatically picked when you pick the sprite.

    Edited by mod to add the link to the containers manual article

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