0 Favourites

Platform: deceleration acting like acceleration

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

  • Hmm. Maybe I didn't upload it correctly.

    In any case, thanks for the fix!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Tutorial: Platform School
267 93,747
Megabeard's avatar
Megabeard
Unread hot topic
121 11,761
Artpunk's avatar
Artpunk
Unread hot topic
95 14,392
LaurenceBedford's avatar
LaurenceBedford