[Plugin] Shake Plugin

0 favourites
From the Asset Store
The I18N (Translation) is a Construct plugin created to translate text in game.
  • Wouldn't you help me?

    If there is no chance, then no problem.

  • Wouldn't you help me?

    If there is no chance, then no problem.

    HEre is the formula, what were you looking for particularly?

         if(runShake){
                   // Get all instances with this behavior
                   var all = this.behavior.my_instances.values();
                   var sumx = 0, sumy = 0;
                   var i, len;
                   
                   for (i = 0, len = all.length; i < len; i++)
                   {
                        sumx += all[i].x;
                        sumy += all[i].y;
                   }
                   
                   var layout = this.inst.layer.layout;
                   
                   // Is in a shake?
                   var now = this.runtime.kahanTime.sum;
                   var offx = 0, offy = 0;
                   
                   if (now >= this.behavior.shakeStart && now < this.behavior.shakeEnd)
                   {
                        var mag = this.behavior.shakeMag * Math.min(this.runtime.timescale, 1);
                        
                        // Mode 0 - reducing magnitude - lerp to zero
                        if (this.behavior.shakeMode === 0)
                             mag *= 1 - (now - this.behavior.shakeStart) / (this.behavior.shakeEnd - this.behavior.shakeStart);
                             
                        var a = Math.random() * Math.PI * 2;
                        var d = Math.random() * mag;
                        offx = Math.cos(a) * d;
                        offy = Math.sin(a) * d;
                   }
                   
                   layout.scrollToX((sumx / all.length + offx)+xOffset);
                   layout.scrollToY((sumy / all.length + offy)+yOffset);          
              }
    
  • Tried this today and here is what I get. Help please?

  • Got the same error

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • firebelly

    Thank you so much!

  • link=dead

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