Set MaxTranslation

0 favourites
  • 6 posts
From the Asset Store
A whole set you need to create a gorgeous winter 2d game
  • I'd like to know if anyone could help me.

    As far as I know this is not possible yet.

    I want to set this inside of construct rather than outside.

    Box2D.Common.b2Settings.b2_maxTranslation = 10.0;

    It is by default..

    Box2D.Common.b2Settings.b2_maxTranslation = 2.0;

    Possibly something I can add on the event sheet and then set the value from 2.0 to any number . Pref 10.0.

    What I have been doing so far is exporting construct and then editing the .js file at the "Box2D.Common.b2Settings.b2_maxTranslation = 2.0;" point to "Box2D.Common.b2Settings.b2_maxTranslation = 10.0;" and it gives me my desired results but I'd much rather be able to do so inside of construct so I can use the Preview.

    Thanks so much in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How about using Developer Mode (updates plugins every time you preview)?

    You'll still have to modify the plugin outside of Construct 2, but you'll be able to use 'preview' without having to restart Construct 2.

    Otherwise, you might want to just create a new 'Set' action for the plugin that modifies that property.

  • I'm more just looking for something that can set "Box2D.Common.b2Settings.b2_maxTranslation = 10.0;" rather than "Box2D.Common.b2Settings.b2_maxTranslation = 2.0;" when exporting/previewing. I am lost on how I can get a plugin to set this.

    --I think this might be impossible to do in plugin and will only work if i don't minify the script edit the value to 10.0 manually than minify it with a separate tool. This is a pain though.

  • Well the value you're talking about is "hardcoded" in the physics behavior itself.

    Apparently, it is used (its derivated Box2D.Common.b2Settings.b2_maxTranslationSquared) in the "Step" operation.

    Atm, apart from making another physics behavior in which you would encode 10.0 instead of 2.0, I don't think there is a way to modify this value from C2, it's just not interfaced to be modified.

    If you want you can make a copy/derivative of the physics behavior's folder and modify the value l.73 of runtime.js. Be sure to check the SDK manual and to make backup copies of the original behavior before any change.

    Also be aware that modifying/using a custom plugin/behavior will make it so that you can't upload your final game to Scirra's arcade (in case you were aiming to publish your game there).

  • Wow, Thank you so much kyatric.

    For anyone searching for this all I did was edit "Construct 2\exporters\html5\behaviors\physics\runtime.js" and change the "Box2D.Common.b2Settings.b2_maxTranslation = 2.0;" value into "Box2D.Common.b2Settings.b2_maxTranslation = 10.0;" I will have to change it back when working on other projects.

    You saved me a lot of time Kyatric :D !

    --How do I give you rep? <img src="smileys/smiley3.gif" border="0" align="middle" />

  • --How do I give you rep? <img src="smileys/smiley3.gif" border="0" align="middle">

    You can upvote comments of mine on the tutorials or on the blog articles.

    Maybe upvoting directly tutorials of mine.

    Otherwise votes and feedback on my games uploaded in the arcade are always appreciated.

    <img src="smileys/smiley1.gif" border="0" align="middle">

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