How to find the name of a sprite for create by name

  • Hello;

    Suppose I have two sprites, baseBall and softBall and they are both members of the ball family.

    Is the name baseBall stored somewhere so I can use it (for saving as json) in the baseBall sprite or do I have to put a character string variable in and call it "baseBall" in order to create by name later on when I load this member of the ball family from a json string?

    thanks for your time.

    winkr7

  • Nope. You don't want a list of strings sitting around in the runtime anyway. That's too easy to hack.

    Make your own id in variables, or an array etc.

  • thanks newt.

    If my baseBall is a member of sportsEquip and the Ball family how do I load it from Jason?

    Do I save it as baseBall (since it is both a sportsEquip family and a Ball family) then when it comes time to load from json do I create by name "baseBall" but then load by json after casting it as sportsEquip or Ball)? Ie which load from json should I use after I create it?

    To get to the sportequip casting do I use Pick by last create (since I just created "baseball" so the last creation of sportequip was in fact a "baseball". Or should I Pick by last created and use the Ball family? Or does it matter?

    thanks for your time.

    yours

    winkr7

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Anything you want to do to it needs to be done when you create it.

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