is there a difference between this._inst.GetWorldInfo() and this.GetWorldInfo() ?

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported
  • I'm a bit confused as I dig around official behaviors.

    I see examples of both the following:

    	const wi = this._inst.GetWorldInfo();
    
    	//some other place in the same behavior
    	const wi = this.GetworldInfo();
    
    
    

    In the manual, this._inst is defined as:

    Reference to the Instance representing this instance in the runtime. This allows access to Construct's built-in runtime features for instances.

    If I am defining a behavior and working inside the Instance.js file, are those 2 lines of code synonymous? For that matter then, wouldn't the following work:

    	const wi = this._worldInfo;
    

    Or do I completely misunderstand?

    I'm just confused why both are used (reference custom movement).

  • If you are looking at the code in Construct's built-in behaviors, all of that is considered internal details for support purposes, and we won't provide any support for that or answer any questions about them. It is not intended that anyone looks at internal code, and internal code can change at any time for any reason, including completely replacing it.

    Many of the behaviors are also pretty old (with code originally dating back 10 years or more), and as anyone who has dealt with codebases over that period of time can advise, such code is often full of odd quirks, compatibility changes, and other weird stuff, and so I would strongly caution against trying to infer what kind of code you ought to be writing from internal code.

  • It is not intended that anyone looks at internal code?

    I would strongly caution against trying to infer what kind of code you ought to be writing from internal code.

    But there are no other examples to refer to! The manual has few to no examples for most entries, and the forum support for JS is quite limited. What in tarnished brass trumpets are we supposed to do ?!... this is getting very exasperating.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley , also _inst is in the manual too

    construct.net/en/make-games/manuals/addon-sdk/runtime-reference/base-classes/sdkbehaviorinstancebase

    So... What is the difference between:

    this._inst.GetWorldInfo();

    and

    this.GetWorldInfo();

    In the context of behaviors: Nothing??? Seems like there are both methods for getting those things as well as properties, and no real guidence as to which we should use and why?

    Why bother with this.GetRuntime when I can just say this._runtime ?

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