Hi guys so I was writting a secret plugin although I meet a problem....this method is like TO MUCH big and have repetetive code in it...so I would like to ask you to show me possible way's to shortening this method?
because I will being honest it's like 51 freaking line's >>"
Emoji_Secret.prototype.updatePictureSprite = function(sprite) {// setting the sprite bitmap. sprite.bitmap = this._imageBitmap;// if spinBitmap is enabled it's will doing rotative movement. if (this.spinBitmap){ sprite.rotation += this.rotationSpeed;// else if rotation = 0 it's not affecting the sprite. } else if (this.rotationSpeed === 0 ){ sprite.rotation = 0;// else the sprite is serve for reference and rotating the sprite in a // specific angle. } else { sprite.rotation = Math.PI / this.radiant; }// Starting Sprite movement.// if static is enabled. if (this.enableStatic){ // if particle are falling. if (this.fallingParticle){ sprite.ay += this.speed * Math.cos(sprite.rotation); // else particle are moving in up movement. } else { sprite.ax += this.speed * Math.sin(sprite.rotation); } // if inverted Axis is enabled for sprite it's go for the right if (this.invertAxis){ sprite.ax -= this.speed * Math.sin(sprite.rotation); // else the sprite will start from the left. } else { sprite.ay += this.speed * Math.cos(sprite.rotation); } // if static is not enabled. } else { // if particle are falling. if (this.fallingParticle){ sprite.ay += this.speed; // else particle are moving in up movement. } else { sprite.ay -= this.speed; } // if inverted Axis is enabled for sprite it's go for the right if (this.invertAxis){ sprite.ax -= this.speed; // else the sprite will start from the left. } else { sprite.ax += this.speed; } }// FadeOut the sprite. sprite.opacity -= this.speed; };thanks for any further answer
because I will being honest it's like 51 freaking line's >>"
Emoji_Secret.prototype.updatePictureSprite = function(sprite) {// setting the sprite bitmap. sprite.bitmap = this._imageBitmap;// if spinBitmap is enabled it's will doing rotative movement. if (this.spinBitmap){ sprite.rotation += this.rotationSpeed;// else if rotation = 0 it's not affecting the sprite. } else if (this.rotationSpeed === 0 ){ sprite.rotation = 0;// else the sprite is serve for reference and rotating the sprite in a // specific angle. } else { sprite.rotation = Math.PI / this.radiant; }// Starting Sprite movement.// if static is enabled. if (this.enableStatic){ // if particle are falling. if (this.fallingParticle){ sprite.ay += this.speed * Math.cos(sprite.rotation); // else particle are moving in up movement. } else { sprite.ax += this.speed * Math.sin(sprite.rotation); } // if inverted Axis is enabled for sprite it's go for the right if (this.invertAxis){ sprite.ax -= this.speed * Math.sin(sprite.rotation); // else the sprite will start from the left. } else { sprite.ay += this.speed * Math.cos(sprite.rotation); } // if static is not enabled. } else { // if particle are falling. if (this.fallingParticle){ sprite.ay += this.speed; // else particle are moving in up movement. } else { sprite.ay -= this.speed; } // if inverted Axis is enabled for sprite it's go for the right if (this.invertAxis){ sprite.ax -= this.speed; // else the sprite will start from the left. } else { sprite.ax += this.speed; } }// FadeOut the sprite. sprite.opacity -= this.speed; };thanks for any further answer
Last edited by a moderator:

