Platform: deceleration acting like acceleration

0 favourites
  • 4 posts
From the Asset Store
Wanting to do a Shot n Run game easily? Here is your chance!
  • 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.

  • 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

    acts.SetDeceleration = function (acc)
         {
              this.acc = acc;
              
              if (this.acc < 0)
                   this.acc = 0;
         };
    

    Replace it with :

    acts.SetDeceleration = function (dec)
         {
              this.dec = dec;
              
              if (this.dec > 0)
                   this.dec = 0;
         };
    

    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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm. Maybe I didn't upload it correctly.

    In any case, thanks for the fix!

  • 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.

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