JAVASCRIPT   11

Gravity.js

Guest on 31st May 2021 02:36:28 AM

  1. /**
  2.  * @author       Richard Davey <rich@photonstorm.com>
  3.  * @copyright    2020 Photon Storm Ltd.
  4.  * @license      {@link https://opensource.org/licenses/MIT|MIT License}
  5.  */
  6.  
  7. /**
  8.  * A component to manipulate world gravity for Matter.js bodies.
  9.  *
  10.  * @namespace Phaser.Physics.Matter.Components.Gravity
  11.  * @since 3.0.0
  12.  */
  13. var Gravity = {
  14.  
  15.     /**
  16.      * A togglable function for ignoring world gravity in real-time on the current body.
  17.      *
  18.      * @method Phaser.Physics.Matter.Components.Gravity#setIgnoreGravity
  19.      * @since 3.0.0
  20.      *
  21.      * @param {boolean} value - Set to true to ignore the effect of world gravity, or false to not ignore it.
  22.      *
  23.      * @return {Phaser.GameObjects.GameObject} This Game Object.
  24.      */
  25.     setIgnoreGravity: function (value)
  26.     {
  27.         this.body.ignoreGravity = value;
  28.  
  29.         return this;
  30.     }
  31.  
  32. };
  33.  
  34. module.exports = Gravity;

Raw Paste


Login or Register to edit or fork this paste. It's free.