Colludium's Recent Forum Activity

  • X3M, I'm afraid I can't get it to work. I don't know how to correlate "_this" with "this" in the scope of the "Box2D...Velocities" function? Looking through the array "_this" it appears that it's populated with values from only one object rather than arrays for each one that hold's the behaviour I'm testing.

    As an aside, there's a lot more data included in "_this" than I ever expected...!! Thanks!

  • Colludium The reason why it doesn't work is because the statement "this" is encapsulated inside the instance prototypes scopes. So it cannot pass the borders towards other functions, therfore you should pass it as a paramter if you're planning to make your own function outside the .prototypes. If it is a function of a library such as Box2D , which is the case here, you should assign it to a global variable declared outside the scopes.

    Like this:

    > var _this;
    instanceProto.onCreate = function () {
    _this = this;
    this.gravFactor = this.properties[8];
    ....
    }
    
    Box2D.Dynamics.b2Island.prototype._InitializeVelocities = function(step, gravity){
     alert(_this.gravFactor);
    ....
    }
    [/code:1bq1ng6p]
    
    Use _this inside the Box2D functions
    

    X3M - thank you. I was focusing too much on trying to find a way to reverse-navigate up the scopes somehow. I'll give it a go now - it looks perfect and perfectly simple .

  • Hello! I hope you might be able to help me with a bit of plugin manipulation. I'm slowly honing my understanding of Javascript and the SDK but I've come up against a bit of a mental brick-wall. The problem could be as much to do with my limited understanding of the Box2D Physics plugin as much as my superficial knowledge of Javascript....

    Here's the problem:

    When I create an object with my behaviour, it receives a variable via the OnCreate function, from edittime.js, thus:

    this.gravFactor = this.properties[8];[/code:hwl4jqr4]
    
    So far, so good.  Now, how can I access that instance variable gravFactor inside a Box2d function (my understanding of OOP is beaten here and I am about to resort to trial and error!):
    
    [code:hwl4jqr4]Box2D.Dynamics.b2Island.prototype._InitializeVelocities = function(step, gravity)[/code:hwl4jqr4]
    
    Getting this to work would be magic (and would open up a world of buoyant objects with different gravity values...).  Thanks!
  • I would use a hidden text object but only fill it with text up to and including the space before the word you're interested in. Use the text width property (not the text object width) and add it to the text object's bounding box left position. That will give you the starting/left x position. You could also measure the width of a single word using a similar technique. Just note that it takes one tick for these text width values to populate after signing the text content.

  • C2 JSON Manager — Now for sale in the Scirra Store!

    https://www.scirra.com/store/game-making-tools/c2-json-manager-3138

    <p>This Construct 2 JSON Manager tool enables you to easily manage nested data structures (of dictionary and array objects). The visual editor makes it easy to see and edit each set of data. The exported .json file can be imported directly into Construct 2 using the AJAX plugin (or copy the string and paste into the editor). </p><p>Summary of actions:</p>

    • Create blank dictionary or array objects inside each other (unlimited nesting).
    • Paste additional AsJSON strings into arrays and dictionaries; these will be recognised by this editor so you can go into them and further edit as required.
    • Delete rows / columns of array data and delete keys of dictionaries.
    • Undo action to correct your mistakes (within the current edit level).
    • Change the displayed X / Y axes.
    • Use the zero array cell contents as axis labels - optional.
    • Save the current data separately from within the whole data structure.
    • Save the whole data structure at any time.
    • Alerts you to duplicate dictionary keys.
    • Search function.
    • Navigate using the arrow keys.

    Use this topic to leave comments, ask questions and talk about C2 JSON Manager

  • Great news that you've identified and fixed the problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Check the font size inside the text box. You might have it not set to auto, so smaller window sizes will cause the font to be too large to be displayed. You can also use the browser log action to display the asjson of the array, just to confirm that it's correct, and to display the text box.text value.

  • Would a plugin suffice ?

  • PM sent 😀

  • What type of game are you working on atm?

    Mate, I just completed my json editor (which was more involved than I anticipated) and I'm now struggling to get back into my other project - a multiplayer party game. I've so far completed an asterois-inspired level but my ambition to introduce an upgrade system is getting the better off me - because I work on it part time and adding this feature without breaking what I already have is daunting.

  • OK KYATRIC. I was simply asking a philosophical question regarding whether a free demo would be acceptable or not (this applies both to submissions to the store and the arcade). I take it that there is no policy, so if I decide to submit anything to then I'll await judgement accordingly.

  • Awesome!

Colludium's avatar

Colludium

Member since 26 Aug, 2013

Twitter
Colludium has 11 followers

Connect with Colludium

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • x3
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies