Class

io.scalajs.dom.html.phaser.physics.arcade

Body

Related Doc: package arcade

Permalink

class Body extends Object

The Physics Body is linked to a single Sprite. All physics operations should be performed against the body rather than the Sprite itself. For example you can set the velocity, acceleration, bounce values etc all on the Body.

Annotations
@RawJSType() @native() @JSName( "Phaser.Physics.Arcade.Body" )
See also

https://phaser.io/docs/2.6.2/Phaser.Physics.Arcade.Body.html

Linear Supertypes
Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Body
  2. Object
  3. Any
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Body(sprite: Phaser.Sprite)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. var acceleration: Phaser.Point

    Permalink

    The acceleration is the rate of change of the velocity.

    The acceleration is the rate of change of the velocity. Measured in pixels per second squared.

  5. var allowGravity: Boolean

    Permalink

    Allow this Body to be influenced by gravity? Either world or local.

  6. var allowRotation: Boolean

    Permalink

    Allow this Body to be rotated? (via angularVelocity, etc)

  7. def angle: Double

    Permalink

    The angle of the Body's velocity in radians.

  8. var angularAcceleration: Double

    Permalink

    The angular acceleration is the rate of change of the angular velocity.

    The angular acceleration is the rate of change of the angular velocity. Measured in degrees per second squared.

  9. var angularDrag: Double

    Permalink

    The drag applied during the rotation of the Body.

    The drag applied during the rotation of the Body. Measured in degrees per second squared.

  10. var angularVelocity: Double

    Permalink

    The angular velocity controls the rotation speed of the Body.

    The angular velocity controls the rotation speed of the Body. It is measured in degrees per second.

  11. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  12. var blocked: Any

    Permalink

    This object is populated with boolean values when the Body collides with the World bounds or a Tile.

    This object is populated with boolean values when the Body collides with the World bounds or a Tile. For example if blocked.up is true then the Body cannot move up. An object containing on which faces this Body is blocked from moving, if any.

  13. def bottom: Double

    Permalink

    The bottom value of this Body (same as Body.y + Body.height)

  14. var bounce: Phaser.Point

    Permalink

    The elasticity of the Body when colliding.

    The elasticity of the Body when colliding. bounce.x/y = 1 means full rebound, bounce.x/y = 0.5 means 50% rebound velocity.

  15. def center: Phaser.Point

    Permalink

    The center coordinate of the Physics Body.

  16. var checkCollision: Any

    Permalink

    Set the checkCollision properties to control which directions collision is processed for this Body.

    Set the checkCollision properties to control which directions collision is processed for this Body. For example checkCollision.up = false means it won't collide when the collision happened while moving up. If you need to disable a Body entirely, use body.enable = false, this will also disable motion. If you need to disable just collision and/or overlap checks, but retain motion, set checkCollision.none = true. An object containing allowed collision.

  17. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. var collideWorldBounds: Boolean

    Permalink

    A Body can be set to collide against the World bounds automatically and rebound back into the World if this is set to true.

    A Body can be set to collide against the World bounds automatically and rebound back into the World if this is set to true. Otherwise it will leave the World. Should the Body collide with the World bounds?

  19. var customSeparateX: Boolean

    Permalink

    This flag allows you to disable the custom x separation that takes place by Physics.Arcade.separate.

    This flag allows you to disable the custom x separation that takes place by Physics.Arcade.separate. Used in combination with your own collision processHandler you can create whatever type of collision response you need. Use a custom separation system or the built-in one?

  20. var customSeparateY: Boolean

    Permalink

    This flag allows you to disable the custom y separation that takes place by Physics.Arcade.separate.

    This flag allows you to disable the custom y separation that takes place by Physics.Arcade.separate. Used in combination with your own collision processHandler you can create whatever type of collision response you need. Use a custom separation system or the built-in one?

  21. var deltaMax: Phaser.Point

    Permalink

    The Sprite position is updated based on the delta x/y values.

    The Sprite position is updated based on the delta x/y values. You can set a cap on those (both +-) using deltaMax.

  22. var dirty: Boolean

    Permalink

    If this Body in a preUpdate (true) or postUpdate (false) state?

  23. var drag: Phaser.Point

    Permalink

    The drag applied to the motion of the Body.

  24. var embedded: Boolean

    Permalink

    If a body is overlapping with another body, but neither of them are moving (maybe they spawned on-top of each other?) this is set to true.

    If a body is overlapping with another body, but neither of them are moving (maybe they spawned on-top of each other?) this is set to true. Body embed value.

  25. var enable: Boolean

    Permalink

    A disabled body won't be checked for any form of collision or overlap or have its pre/post updates run.

  26. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  27. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  28. var facing: Int

    Permalink

    A const reference to the direction the Body is traveling or facing.

  29. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  30. var friction: Phaser.Point

    Permalink

    The amount of movement that will occur if another object 'rides' this one.

  31. var game: Phaser.Game

    Permalink

    Local reference to game.

  32. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  33. var gravity: Phaser.Point

    Permalink

    A local gravity applied to this Body.

    A local gravity applied to this Body. If non-zero this over rides any world gravity, unless Body.allowGravity is set to false.

  34. def halfHeight: Double

    Permalink

    The calculated height / 2 of the physics body.

  35. def halfWidth: Double

    Permalink

    The calculated width / 2 of the physics body.

  36. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  37. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  38. def height: Double

    Permalink

    The calculated height of the physics body.

  39. def immovable: Boolean

    Permalink

    An immovable Body will not receive any impacts from other bodies.

  40. def isCircle: Boolean

    Permalink

    If true this Body is using circular collision detection.

    If true this Body is using circular collision detection. If false it is using rectangular. Use Body.setCircle to control the collision shape this Body uses.

  41. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  42. var isMoving: Boolean

    Permalink

    Set by the moveTo and moveFrom methods.

  43. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  44. var left: Double

    Permalink

    The x position of the Body.

    The x position of the Body. The same as Body.x.

  45. var mass: Double

    Permalink

    The mass of the Body.

    The mass of the Body. When two bodies collide their mass is used in the calculation to determine the exchange of velocity (default: 1).

  46. var maxAngular: Double

    Permalink

    The maximum angular velocity in degrees per second that the Body can reach.

  47. var maxVelocity: Phaser.Point

    Permalink

    The maximum velocity in pixels per second sq.

    The maximum velocity in pixels per second sq. that the Body can reach.

  48. var movementCallback: Function

    Permalink

    Optional callback.

    Optional callback. If set, invoked during the running of moveTo or moveFrom events.

  49. var movementCallbackContext: Object

    Permalink

    Context in which to call the movementCallback.

  50. var moves: Boolean

    Permalink

    If you have a Body that is being moved around the world via a tween or a Group motion, but its local x/y position never actually changes, then you should set Body.moves = false.

    If you have a Body that is being moved around the world via a tween or a Group motion, but its local x/y position never actually changes, then you should set Body.moves = false. Otherwise it will most likely fly off the screen.

    If you want the physics system to move the body around, then set moves to true. Set to true to allow the Physics system to move this Body, otherwise false to move it manually.

  51. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  52. def newVelocity: Phaser.Point

    Permalink

    The new velocity.

    The new velocity. Calculated during the Body.preUpdate and applied to its position.

  53. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  54. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  55. var offset: Phaser.Point

    Permalink

    The offset of the Physics Body from the Sprite x/y position.

  56. var onCollide: Phaser.Signal

    Permalink

    A Signal that is dispatched when this Body collides with another Body.

    A Signal that is dispatched when this Body collides with another Body. * You still need to call game.physics.arcade.collide in your update method in order for this signal to be dispatched. * Usually you'd pass a callback to the collide method, but this signal provides for a different level of notification. * Due to the potentially high volume of signals this could create it is disabled by default. * To use this feature set this property to a Phaser.Signal:

    sprite.body.onCollide = new Phaser.Signal()

    and it will be called when a collision happens, passing two arguments: the sprites which collided. The first sprite in the argument is always the owner of this Body. * If two Bodies with this Signal set collide, both will dispatch the Signal.

  57. var onMoveComplete: Phaser.Signal

    Permalink

    Listen for the completion of moveTo or moveFrom events.

  58. var onOverlap: Phaser.Signal

    Permalink

    A Signal that is dispatched when this Body overlaps with another Body.

    A Signal that is dispatched when this Body overlaps with another Body.

    You still need to call game.physics.arcade.overlap in your update method in order for this signal to be dispatched.

    Usually you'd pass a callback to the overlap method, but this signal provides for a different level of notification.

    Due to the potentially high volume of signals this could create it is disabled by default.

    To use this feature set this property to a Phaser.Signal: sprite.body.onOverlap = new Phaser.Signal() and it will be called when a collision happens, passing two arguments: the sprites which collided. The first sprite in the argument is always the owner of this Body.

    If two Bodies with this Signal set collide, both will dispatch the Signal.

  59. var onWorldBounds: Phaser.Signal

    Permalink

    A Signal that is dispatched when this Body collides with the world bounds.

    A Signal that is dispatched when this Body collides with the world bounds. Due to the potentially high volume of signals this could create it is disabled by default. To use this feature set this property to a Phaser.Signal:

    sprite.body.onWorldBounds = new Phaser.Signal()

    and it will be called when a collision happens, passing five arguments:

    onWorldBounds(sprite, up, down, left, right)

    where the Sprite is a reference to the Sprite that owns this Body, and the other arguments are booleans indicating on which side of the world the Body collided.

  60. var overlapR: Double

    Permalink

    If Body.isCircle is true, and this body collides with another circular body, the amount of overlap is stored here.

    If Body.isCircle is true, and this body collides with another circular body, the amount of overlap is stored here. The amount of overlap during the collision.

  61. var overlapX: Double

    Permalink

    When this body collides with another, the amount of overlap is stored here.

    When this body collides with another, the amount of overlap is stored here. The amount of horizontal overlap during the collision.

  62. var overlapY: Double

    Permalink

    When this body collides with another, the amount of overlap is stored here.

    When this body collides with another, the amount of overlap is stored here. The amount of vertical overlap during the collision.

  63. def position: Phaser.Point

    Permalink

    The position of the physics body.

  64. def preRotation: Double

    Permalink

    The previous rotation of the physics body.

  65. def prev: Phaser.Point

    Permalink

    The previous position of the physics body.

  66. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  67. def radius: Double

    Permalink

    The radius of the circular collision shape this Body is using if Body.setCircle has been enabled.

    The radius of the circular collision shape this Body is using if Body.setCircle has been enabled. If you wish to change the radius then call setCircle again with the new value. If you wish to stop the Body using a circle then call setCircle with a radius of zero (or undefined).

  68. def right: Double

    Permalink

    The right value of this Body (same as Body.x + Body.width)

  69. def rotation: Double

    Permalink

    The Body's rotation in degrees, as calculated by its angularVelocity and angularAcceleration.

    The Body's rotation in degrees, as calculated by its angularVelocity and angularAcceleration. Please understand that the collision Body

    itself never rotates, it is always axis-aligned. However these values are passed up to the parent Sprite and updates its rotation.

  70. var skipQuadTree: Boolean

    Permalink

    If true and you collide this Sprite against a Group, it will disable the collision check from using a QuadTree.

  71. def sourceHeight: Double

    Permalink

    The un-scaled original size.

  72. def sourceWidth: Double

    Permalink

    The un-scaled original size.

  73. def speed: Double

    Permalink

    The speed of the Body as calculated by its velocity.

  74. val sprite: Phaser.Sprite

    Permalink
  75. var stopVelocityOnCollide: Boolean

    Permalink

    Set by the moveTo and moveFrom methods.

  76. var syncBounds: Boolean

    Permalink

    If true the Body will check itself against the Sprite.getBounds() dimensions and adjust its width and height accordingly.

    If true the Body will check itself against the Sprite.getBounds() dimensions and adjust its width and height accordingly. If false it will compare its dimensions against the Sprite scale instead, and adjust its width height if the scale has changed. Typically you would need to enable syncBounds if your sprite is the child of a responsive display object such as a FlexLayer, or in any situation where the Sprite scale doesn't change, but its parents scale is effecting the dimensions regardless.

  77. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  78. var tilePadding: Phaser.Point

    Permalink

    If this is an especially small or fast moving object then it can sometimes skip over tilemap collisions if it moves through a tile in a step.

    If this is an especially small or fast moving object then it can sometimes skip over tilemap collisions if it moves through a tile in a step.

    Set this padding value to add extra padding to its bounds. tilePadding.x applied to its width, y to its height. Extra padding to be added to this sprite's dimensions when checking for tile collision.

  79. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  80. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  81. var top: Double

    Permalink

    The y position of the Body.

    The y position of the Body. The same as Body.y.

  82. var touching: Object

    Permalink

    This object is populated with boolean values when the Body collides with another.

    This object is populated with boolean values when the Body collides with another. touching.up = true means the collision happened to the top of this Body for example. An object containing touching results.

  83. var type: Int

    Permalink

    The type of physics system this body belongs to.

  84. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  85. var velocity: Point

    Permalink

    The velocity, or rate of change in speed of the Body.

    The velocity, or rate of change in speed of the Body. Measured in pixels per second.

  86. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  87. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  88. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  89. var wasTouching: Object

    Permalink

    This object is populated with previous touching values from the bodies previous collision.

    This object is populated with previous touching values from the bodies previous collision. An object containing previous touching results.

  90. def width: Double

    Permalink

    The calculated width of the physics body.

  91. var worldBounce: Phaser.Point

    Permalink

    The elasticity of the Body when colliding with the World bounds.

    The elasticity of the Body when colliding with the World bounds. By default this property is null, in which case Body.bounce is used instead. Set this property to a Phaser.Point object in order to enable a World bounds specific bounce value.

  92. var x: Double

    Permalink

    The x position.

  93. var y: Double

    Permalink

    The y position.

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped