Class/Object

io.scalajs.dom.html.phaser

Physics

Related Docs: object Physics | package phaser

Permalink

class Physics extends Object

The Physics Manager is responsible for looking after all of the running physics systems. Phaser supports 4 physics systems: Arcade Physics, P2, Ninja Physics and Box2D via a commercial plugin.

Game Objects (such as Sprites) can only belong to 1 physics system, but you can have multiple systems active in a single game.

For example you could have P2 managing a polygon-built terrain landscape that an vehicle drives over, while it could be firing bullets that use the faster (due to being much simpler) Arcade Physics system.

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

http://phaser.io/docs/2.6.2/Phaser.Physics.html

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

Instance Constructors

  1. new Physics(game: Phaser.Game, config: |[PhysicsConfig, RawOptions])

    Permalink

    game

    A reference to the currently running game.

    config

    A physics configuration object to pass to the Physics world on creation.

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 arcade: Arcade

    Permalink

    The Arcade Physics system.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. var box2d: Box2D

    Permalink

    The Box2D Physics system.

  7. var chipmunk: Chipmunk

    Permalink

    The Chipmunk Physics system (to be done).

  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. var config: |[PhysicsConfig, RawOptions]

    Permalink

    A physics configuration object to pass to the Physics world on creation.

  10. def destroy(): Unit

    Permalink

    Destroys all active physics systems.

    Destroys all active physics systems. Usually only called on a Game Shutdown, not on a State swap.

  11. def enable(object: |[Object, Array[_]] = js.native, system: Int = js.native, debug: Boolean = js.native): Unit

    Permalink

    This will create a default physics body on the given game object or array of objects.

    This will create a default physics body on the given game object or array of objects. A game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed. It can be for any of the physics systems that have been started: Phaser.Physics.Arcade - A light weight AABB based collision system with basic separation. Phaser.Physics.P2JS - A full-body advanced physics system supporting multiple object shapes, polygon loading, contact materials, springs and constraints. Phaser.Physics.NINJA - A port of Metanet Softwares N+ physics system. Advanced AABB and Circle vs. Tile collision. Phaser.Physics.BOX2D - A port of https://code.google.com/p/box2d-html5 Phaser.Physics.MATTER - A full-body and light-weight advanced physics system (still in development) Phaser.Physics.CHIPMUNK is still in development. If you require more control over what type of body is created, for example to create a Ninja Physics Circle instead of the default AABB, then see the individual physics systems enable methods instead of using this generic one.

    system

    The physics system that will be used to create the body. Defaults to Arcade Physics.

    debug

    Enable the debug drawing for this body. Defaults to false.

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

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

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

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

    Permalink

    A reference to the currently running game.

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

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

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

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

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

    Permalink
    Definition Classes
    Object
  21. var matter: Matter

    Permalink

    The MatterJS Physics system (coming soon).

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

    Permalink
    Definition Classes
    AnyRef
  23. var ninja: Ninja

    Permalink

    The N+ Ninja Physics system.

  24. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  26. var p2: P2

    Permalink

    The P2.JS Physics system.

  27. def parseConfig(): Unit

    Permalink

    Parses the Physics Configuration object passed to the Game constructor and starts any physics systems specified within.

  28. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  29. def setBoundsToWorld(left: Boolean = js.native, right: Boolean = js.native, top: Boolean = js.native, bottom: Boolean = js.native, setCollisionGroup: Boolean = js.native): Unit

    Permalink

    Sets the bounds of the Physics world to match the Game.World dimensions.

    Sets the bounds of the Physics world to match the Game.World dimensions. You can optionally set which 'walls' to create: left, right, top or bottom.

    left

    If true will create the left bounds wall.

    right

    If true will create the right bounds wall.

    top

    If true will create the top bounds wall.

    bottom

    If true will create the bottom bounds wall.

    setCollisionGroup

    If true the Bounds will be set to use its own Collision Group.

  30. def setWorldMaterial(material: Material, left: Boolean = js.native, right: Boolean = js.native, top: Boolean = js.native, bottom: Boolean = js.native): Unit

    Permalink

    Sets the given material against the 4 bounds of this World.

    Sets the given material against the 4 bounds of this World.

    material

    The material to set.

    left

    If true will set the material on the left bounds wall.

    right

    If true will set the material on the right bounds wall.

    top

    If true will set the material on the top bounds wall.

    bottom

    If true will set the material on the bottom bounds wall.

  31. def startSystem(system: Int): Unit

    Permalink

    This will create an instance of the requested physics simulation.

    This will create an instance of the requested physics simulation. Phaser.Physics.Arcade is running by default, but all others need activating directly. You can start the following physics systems: Phaser.Physics.P2JS - A full-body advanced physics system by Stefan Hedman. Phaser.Physics.NINJA - A port of Metanet Softwares N+ physics system. Phaser.Physics.BOX2D - A commercial Phaser Plugin (see http://phaser.io) Both Ninja Physics and Box2D require their respective plugins to be loaded before you can start them. They are not bundled into the core Phaser library. If the physics world has already been created (i.e. in another state in your game) then calling startSystem will reset the physics world, not re-create it. If you need to start them again from their constructors then set Phaser.Physics.p2 (or whichever system you want to recreate) to null before calling startSystem.

    system

    The physics system to start: Phaser.Physics.ARCADE, Phaser.Physics.P2JS, Phaser.Physics.NINJA or Phaser.Physics.BOX2D.

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped