How do I get instance_vars[0] real name?

  • I'm trying to check for overlap of a solid with:

    var collobj = this.runtime.testOverlapSolid(this.inst);

    Then check a instance variable of the overlap instance. The following works, but i want to reference by its name, not index.

    collobj.instance_vars[0]

    Any help would be appreciated.

  • I got around it by checking all instance variables if they are strings and if it is a string, check for a certain string which then allows my behavior to disable the solid behavior just for my behavior.

    What I did was make a behavior that allows the player to walk through a wall that is solid but blocks all enemies.

  • From what I've learned, you can't access the instance vars by name, because the minifier converts all full variable names to minified names. You can access them using an index number, as you mentioned in the OP, but that can be an unreliable solution. If instance vars get added or removed, then your index changes.

    If your solution works, then that is probably the best way.

  • For the record, the runtime actually removes the names of variables when exporting, it's not to do with the minifier.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the replies. It has helped in making my behavior. I hope to release it soon as it is useful with the game i'm making.

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