Native array methods

0 favourites
  • 5 posts
From the Asset Store
Sync animations, animation frames, mirror state, sounds and anything else using these methods.
  • Hello there!

    I'm using SC2 for several years but it's first time I decide to make my own plugin.

    Well, to improve existing one a little..

    I have experience to work with different programming languages (C++, Delphi, Pascal and some others) and my question is not about how to make some things in JS.

    But I can't find some information about where some methods (functions, properties etc.) came from.

    This is a particular example.

    Plugin: Array

    File: runtime.js

    Where can I find description of this things: cx, cy, cz, forX, forY, forZ, arr, forDepth and some others? I've tried to search it in *.js files in html5 folder but no succeeded.

    I see that we can write this.cx = this.properties[0]; and this will be a Width of our Array.

    And for example var a = this.arr; what is arr? It seems to be smth. like a link to our array but where did we found such description and others?

    Well, another example, what means this.forX = []; or this.forDepth = -1;

    I hope you understand what I want to know. Maybe I just can't see things under my nose

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Those variables are all entirely defined and used within that single file. If you don't know Javascript, it might be better to ask on a site like StackOverflow.com.

  • Well, thank you for your time, Ashley.

    For now I can see that I just mix up in my head declaring and assignment.

    Maybe I need to learn JS more, because I can't understand why we wrote for the first time

    this.cx = this.properties[0]

    instead of

    var this.cx = this.properties[0]

    I thought, that it is an assignment, just not declaration. It seems, that I'm not right..

  • That is normal Javascript style. In constructors, member variables are initialised simply by assigning a value to this.something.

  • This is already an object like var a = {}, so values can be assigned to a.something freely.

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