Set MaxTranslation

Get help using Construct 2

Post » Thu May 24, 2012 2:14 pm

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.
B
10
S
2
Posts: 20
Reputation: 1,258

Post » Thu May 24, 2012 2:36 pm

How about using Developer Mode (updates plugins every time you preview)?
http://www.scirra.com/manual/15/sdk/page-1

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.Dalal2012-05-24 14:38:47
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Thu May 24, 2012 3:00 pm

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.michelangelo2012-05-24 15:05:22
B
10
S
2
Posts: 20
Reputation: 1,258

Post » Thu May 24, 2012 3:58 pm

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).Kyatric2012-05-24 16:00:05
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Thu May 24, 2012 4:05 pm

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? michelangelo2012-05-24 16:09:24
B
10
S
2
Posts: 20
Reputation: 1,258

Post » Thu May 24, 2012 4:57 pm

[QUOTE=michelangelo]
--How do I give you rep? [/QUOTE]

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.

New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791


Return to How do I....?

Who is online

Users browsing this forum: Kagubro, Solomon, Yahoo [Bot] and 30 guests