Class/Object

io.scalajs.dom.html.phaser.physics.P2

Body

Related Docs: object Body | package P2

Permalink

class Body extends Object

The Physics Body is typically linked to a single Sprite and defines properties that determine how the physics body is simulated. These properties affect how the body reacts to forces, what forces it generates on itself (to simulate friction), and how it reacts to collisions in the scene. In most cases, the properties are used to simulate physical effects. Each body also has its own property values that determine exactly how it reacts to forces and collisions in the scene. By default a single Rectangle shape is added to the Body that matches the dimensions of the parent Sprite. See addShape, removeShape, clearShapes to add extra shapes around the Body. Note: When bound to a Sprite to avoid single-pixel jitters on mobile devices we strongly recommend using Sprite sizes that are even on both axis, i.e. 128x128 not 127x127. Note: When a game object is given a P2 body it has its anchor x/y set to 0.5, so it becomes centered.

Annotations
@RawJSType() @native()
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(game: Phaser.Game, sprite: Sprite, x: Int = js.native, y: Int = js.native, mass: Int = js.native)

    Permalink

    game

    Game reference to the currently running game.

    sprite

    The Sprite object this physics body belongs to.

    x

    The x coordinate of this Body.

    y

    The y coordinate of this Body.

    mass

    The default mass of this Body (0 = static).

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. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. var game: Phaser.Game

    Permalink

    Game reference to the currently running game.

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

    Permalink
    Definition Classes
    AnyRef → Any
  11. def hasOwnProperty(v: String): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  15. val mass: Int

    Permalink

    The default mass of this Body (0 = static).

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

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  19. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  20. val sprite: Sprite

    Permalink

    The Sprite object this physics body belongs to.

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

    Permalink
    Definition Classes
    AnyRef
  22. def toLocaleString(): String

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

    Permalink
    Definition Classes
    AnyRef → Any
  24. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  25. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. val x: Int

    Permalink

    The x coordinate of this Body.

  29. val y: Int

    Permalink

    The y coordinate of this Body.

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped