How do I use AsJSON on objects in multiple families?

  • Hello;

    Suppose I have a toy that can be a baseball,volleyball,basketball and red,white,or green. The toy is a member of the ball family and color family each has a data member that says what kind of ball or what color. If I get a string of toy.AsJSON shouldn't that string also know about the other families that toy is a member of?

    When I load toy from the jason string it is randomly selecting what kind of ball and what color, as if it knows it is a member of the family but didn't save what kind in the string.

    How to I save toy to a string and have it know what kind of ball and color the toy is?

    thanks for your time.

    yours

    winkr7

  • Why didn't you use one family called toy with family instance variables 'type' and 'colour'?

  • Try Construct 3

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

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

    I appreciate your time and question. To answer your question--I may want to have something other than toy be in the color family.

    The color and ball families need to stand on their own and not be associated with toy unless toy is a member.

    yours

    winkr7

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