Platform: deceleration acting like acceleration

Bugs will be moved here once resolved.

Post » Sat Oct 22, 2011 5:54 pm

Hello. I'm using r63 of Construct 2. I'm running Windows 7, 64-bit, and I've been testing on Chrome and IE9.

I recently tried to trigger a change in my platformer character's deceleration rate with events. But instead of changing his rate of deceleration, it seems to be changing his rate of acceleration.

I can set his properties to the desired deceleration before I run the layout, and it achieves the expected results: he slips around on the ground like he's running on ice. But with events, no good.

Here's the capx: rebound

The layout I've been testing is called "Prototyping", and all the applicable events are under the "Master" event sheet. When you run the layout, the platformer is supposed to experience a change in deceleration when he collides with the light blue line. The event is at the very bottom of the sheet, under the "Ice" group.

Thanks for your time.
B
15
S
4
G
3
Posts: 38
Reputation: 2,598

Post » Sat Oct 22, 2011 6:13 pm

Oh yeah indeed, it appears to have a bug.

For the quick fix, (because you want it to be quickly fixed, don't you ? ^^) open in a notepad with line numerotation the file "runtime.js" that stands in "c2folder\exporters\html5\behaviors\platform\".

In it looks line 503
[code]acts.SetDeceleration = function (acc)
     {
          this.acc = acc;
          
          if (this.acc < 0)
               this.acc = 0;
     };
[/code]

Replace it with :
[code]acts.SetDeceleration = function (dec)
     {
          this.dec = dec;
          
          if (this.dec > 0)
               this.dec = 0;
     };
[/code]
Save it and launch C2.
This should do the trick.

Be sure to make a backup of the runtime.js file before editing (to be safe).
Ashley should have this fixed in the next release.


I wasn't able to download your capx to test it. Firefox simply displayed it as a web page instead of proposing to download it.
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,999
Reputation: 57,793

Post » Sat Oct 22, 2011 6:33 pm

Hmm. Maybe I didn't upload it correctly.

In any case, thanks for the fix!
B
15
S
4
G
3
Posts: 38
Reputation: 2,598

Post » Sat Oct 22, 2011 6:59 pm

I actually already fixed this before this post - I thought nobody had noticed :) That'll teach me to copy and paste too quickly. Fixed in next build.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests