Class

io.scalajs.dom.html.phaser

Graphics

Related Doc: package phaser

Permalink

class Graphics extends pixijs.Graphics with Core with Angle with AutoCull with Bounds with Destroy with FixedToCamera with InputEnabled with InWorld with LifeSpan with PhysicsBody with Reset

A Graphics object is a way to draw primitives to your game. Primitives include forms of geometry, such as Rectangles, Circles and Polygons. They also include lines, arcs and curves. When you initially create a Graphics object it will be empty. To 'draw' to it you first specify a lineStyle or fillStyle (or both), and then draw a shape.

Annotations
@RawJSType() @native() @JSGlobal( "Phaser.Graphics" )
See also

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

Linear Supertypes
Reset, PhysicsBody, LifeSpan, InWorld, InputEnabled, FixedToCamera, Destroy, Bounds, AutoCull, Angle, Core, pixijs.Graphics, Container, DisplayObject, Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Graphics
  2. Reset
  3. PhysicsBody
  4. LifeSpan
  5. InWorld
  6. InputEnabled
  7. FixedToCamera
  8. Destroy
  9. Bounds
  10. AutoCull
  11. Angle
  12. Core
  13. Graphics
  14. Container
  15. DisplayObject
  16. Object
  17. Any
  18. AnyRef
  19. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Graphics(game: Phaser.Game, x: Double, y: Double)

    Permalink

    game

    Current game instance.

    x

    X-position of the new graphics object.

    y

    Y-position of the new graphics object.

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. def addChild(child: DisplayObject): DisplayObject

    Permalink
    Definition Classes
    Container
  5. def addChildAt(child: DisplayObject, index: Int): DisplayObject

    Permalink
    Definition Classes
    Container
  6. def alignIn(container: |[|[|[|[|[|[|[Phaser.Rectangle, Phaser.Sprite], Phaser.Image], Phaser.Text], Phaser.BitmapText], Phaser.Button], Phaser.Graphics], Phaser.TileSprite], position: Int = js.native, offsetX: Double = js.native, offsetY: Double = js.native): Object

    Permalink

    Aligns this Game Object to the side of another Game Object, or Rectangle, known as the 'parent', in one of 11 possible positions.

    Aligns this Game Object to the side of another Game Object, or Rectangle, known as the 'parent', in one of 11 possible positions. The parent must be a Game Object, or Phaser.Rectangle object. This can include properties such as World.bounds or Camera.view, for aligning Game Objects within the world and camera bounds. Or it can include other Sprites, Images, Text objects, BitmapText, TileSprites or Buttons. Please note that aligning a Sprite to another Game Object does not make it a child of the parent. It simply modifies its position coordinates so it aligns with it.

    container

    The Game Object or Rectangle with which to align this Game Object to. Can also include properties such as World.bounds or Camera.view

    position

    The position constant. One of Phaser.TOP_LEFT (default), Phaser.TOP_CENTER, Phaser.TOP_RIGHT, Phaser.LEFT_CENTER, Phaser.CENTER, Phaser.RIGHT_CENTER, Phaser.BOTTOM_LEFT, Phaser.BOTTOM_CENTER or Phaser.BOTTOM_RIGHT

    offsetX

    A horizontal adjustment of the Containers bounds, applied to the aligned position of the Game Object. Use a negative value to shrink the bounds, positive to increase it.

    offsetY

    A vertical adjustment of the Containers bounds, applied to the aligned position of the Game Object. Use a negative value to shrink the bounds, positive to increase it.

    returns

    This Game Object.

    Definition Classes
    Bounds
  7. var alive: Boolean

    Permalink

    A useful flag to control if the Game Object is alive or dead.

    A useful flag to control if the Game Object is alive or dead.

    This is set automatically by the Health components damage method should the object run out of health. Or you can toggle it via your game code.

    This property is mostly just provided to be used by your game - it doesn't effect rendering or logic updates. However you can use Group.getFirstAlive in conjunction with this property for fast object pooling and recycling.

    Definition Classes
    LifeSpan
    See also

    Phaser.Component.LifeSpan#alive

  8. var alpha: Alpha

    Permalink
    Definition Classes
    DisplayObject
  9. var alphanumber: Double

    Permalink
    Definition Classes
    Container
  10. var anchor: pixijs.Point

    Permalink
    Definition Classes
    DisplayObject
  11. var angle: Double

    Permalink

    The angle property is the rotation of the Game Object in degrees from its original orientation.

    The angle property is the rotation of the Game Object in degrees from its original orientation.

    Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.

    Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90.

    If you wish to work in radians instead of degrees you can use the property rotation instead. Working in radians is slightly faster as it doesn't have to perform any calculations.

    Definition Classes
    GraphicsAngle → DisplayObject
  12. var animations: Phaser.AnimationManager

    Permalink

    If the Game Object is enabled for animation (such as a Phaser.Sprite) this is a reference to its AnimationManager instance.

    If the Game Object is enabled for animation (such as a Phaser.Sprite) this is a reference to its AnimationManager instance. Through it you can create, play, pause and stop animations.

    Definition Classes
    Core
  13. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  14. def autoCull: Boolean

    Permalink

    A Game Object with autoCull set to true will check its bounds against the World Camera every frame.

    A Game Object with autoCull set to true will check its bounds against the World Camera every frame. If it is not intersecting the Camera bounds at any point then it has its renderable property set to false. This keeps the Game Object alive and still processing updates, but forces it to skip the render step entirely. * This is a relatively expensive operation, especially if enabled on hundreds of Game Objects. So enable it only if you know it's required, or you have tested performance and find it acceptable.

    Definition Classes
    AutoCull
  15. def blendMode: BlendMode

    Permalink
    Definition Classes
    Graphics
  16. var body: Body

    Permalink

    body is the Game Objects physics body.

    body is the Game Objects physics body. Once a Game Object is enabled for physics you access all associated properties and methods via it.

    By default Game Objects won't add themselves to any physics system and their body property will be null.

    To enable this Game Object for physics you need to call game.physics.enable(object, system) where object is this object and system is the Physics system you are using. If none is given it defaults to Phaser.Physics.Arcade.

    You can alternatively call game.physics.arcade.enable(object), or add this Game Object to a physics enabled Group.

    Important: Enabling a Game Object for P2 or Ninja physics will automatically set its anchor property to 0.5, so the physics body is centered on the Game Object.

    If you need a different result then adjust or re-create the Body shape offsets manually or reset the anchor after enabling physics.

    Definition Classes
    PhysicsBody
  17. var bottom: Double

    Permalink

    The sum of the y and height properties.

    The sum of the y and height properties. This is the same as y + height - offsetY.

    Definition Classes
    Bounds
  18. def boundsPadding: Padding

    Permalink
    Definition Classes
    Graphics
  19. var cacheAsBitmap: Boolean

    Permalink
    Definition Classes
    DisplayObject
  20. var centerX: Double

    Permalink

    The center x coordinate of the Game Object.

    The center x coordinate of the Game Object. This is the same as (x - offsetX) + (width / 2).

    Definition Classes
    Bounds
  21. var centerY: Double

    Permalink

    The center y coordinate of the Game Object.

    The center y coordinate of the Game Object. This is the same as (y - offsetY) + (height / 2).

    Definition Classes
    Bounds
  22. def children: Array[DisplayObject]

    Permalink
    Definition Classes
    Container
  23. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. var data: Object

    Permalink

    An empty Object that belongs to this Game Object.

    An empty Object that belongs to this Game Object. This value isn't ever used internally by Phaser, but may be used by your own code, or by Phaser Plugins, to store data that needs to be associated with the Game Object, without polluting the Game Object directly.

    Definition Classes
    Core
  25. var debug: Boolean

    Permalink

    A debug flag designed for use with Game.enableStep.

    A debug flag designed for use with Game.enableStep.

    Definition Classes
    Core
  26. def destroy(destroyChildren: Boolean): Unit

    Permalink

    Base destroy method for generic display objects.

    Base destroy method for generic display objects.

    Definition Classes
    GraphicsDestroy → Container
  27. def destroy(): Unit

    Permalink

    Base destroy method for generic display objects.

    Base destroy method for generic display objects.

    Definition Classes
    GraphicsDestroy → DisplayObject
  28. def destroy(destroyChildren: Boolean, destroyTexture: Boolean): Unit

    Permalink

    Destroys the Game Object.

    Destroys the Game Object. This removes it from its parent group, destroys the input, event and animation handlers if present and nulls its reference to game, freeing it up for garbage collection.

    If this Game Object has the Events component it will also dispatch the onDestroy event. You can optionally also destroy the BaseTexture this Game Object is using. Be careful if you've more than one Game Object sharing the same BaseTexture.

    destroyChildren

    Should every child of this object have its destroy method called as well?

    destroyTexture

    Destroy the BaseTexture this Game Object is using? Note that if another Game Object is sharing the same BaseTexture it will invalidate it.

    Definition Classes
    Destroy
  29. def destroyPhase: Boolean

    Permalink

    As a Game Object runs through its destroy method this flag is set to true, and can be checked in any sub-systems or plugins it is being destr

    As a Game Object runs through its destroy method this flag is set to true, and can be checked in any sub-systems or plugins it is being destr

    Definition Classes
    Destroy
  30. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  32. var events: Phaser.Events

    Permalink
    Definition Classes
    Core
  33. def fillAlpha: Alpha

    Permalink
    Definition Classes
    Graphics
  34. var filterArea: pixijs.Rectangle

    Permalink
    Definition Classes
    Container
  35. var filters: Array[AbstractFilter]

    Permalink
    Definition Classes
    Container
  36. def finalize(): Unit

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

    Permalink

    Current game instance.

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  41. var height: Double

    Permalink
    Definition Classes
    Container
  42. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  43. def isMask: Boolean

    Permalink
    Definition Classes
    Graphics
  44. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  45. def kill(): DisplayObject

    Permalink
    Definition Classes
    LifeSpan
  46. var left: Double

    Permalink

    The left coordinate of the Game Object.

    The left coordinate of the Game Object. This is the same as x - offsetX.

    Definition Classes
    Bounds
  47. def lineColor: Color

    Permalink
    Definition Classes
    Graphics
  48. def lineWidth: LineWidth

    Permalink
    Definition Classes
    Graphics
  49. var mask: |[pixijs.Graphics, pixijs.Sprite]

    Permalink
    Definition Classes
    Container
  50. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  53. def offsetX: Double

    Permalink

    The amount the Game Object is visually offset from its x coordinate.

    The amount the Game Object is visually offset from its x coordinate. This is the same as width * anchor.x. It will only be > 0 if anchor.x is not equal to zero.

    Definition Classes
    Bounds
  54. def offsetY: Double

    Permalink

    The amount the Game Object is visually offset from its y coordinate.

    The amount the Game Object is visually offset from its y coordinate. This is the same as height * anchor.y. It will only be > 0 if anchor.y is not equal to zero.

    Definition Classes
    Bounds
  55. def parent: Container

    Permalink
    Definition Classes
    Container
  56. var pivot: pixijs.Point

    Permalink
    Definition Classes
    Container
  57. var position: pixijs.Point

    Permalink
    Definition Classes
    Container
  58. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  59. var renderable: Boolean

    Permalink
    Definition Classes
    Container
  60. def reset(x: Double, y: Double, health: Double = 1): DisplayObject

    Permalink
    Definition Classes
    Reset
  61. def revive(health: Double = 1): DisplayObject

    Permalink
    Definition Classes
    LifeSpan
  62. var right: Double

    Permalink

    The right coordinate of the Game Object.

    The right coordinate of the Game Object. This is the same as x + width - offsetX.

    Definition Classes
    Bounds
  63. var rotation: Double

    Permalink
    Definition Classes
    Container
  64. var scale: pixijs.Point

    Permalink
    Definition Classes
    Container
  65. def setParent(container: Container): Container

    Permalink
    Definition Classes
    DisplayObject
  66. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  67. def tint: Color

    Permalink
    Definition Classes
    Graphics
  68. def toGlobal(position: pixijs.Point): pixijs.Point

    Permalink
    Definition Classes
    DisplayObject
  69. def toLocal(position: pixijs.Point, from: DisplayObject): pixijs.Point

    Permalink
    Definition Classes
    DisplayObject
  70. def toLocaleString(): String

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

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

    Permalink

    The y coordinate of the Game Object.

    The y coordinate of the Game Object. This is the same as y - offsetY.

    Definition Classes
    Bounds
  73. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  74. var visible: Boolean

    Permalink
    Definition Classes
    DisplayObject
  75. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  78. var width: Double

    Permalink
    Definition Classes
    Container
  79. var world: Phaser.Point

    Permalink

    The world coordinates of this Game Object in pixels.

    The world coordinates of this Game Object in pixels. Depending on where in the display list this Game Object is placed this value can differ from position, which contains the x/y coordinates relative to the Game Objects parent.

    Definition Classes
    Core
  80. def worldAlpha: Alpha

    Permalink
    Definition Classes
    Container
  81. def worldTransform: Matrix

    Permalink
    Definition Classes
    DisplayObject
  82. def worldVisible: Boolean

    Permalink
    Definition Classes
    DisplayObject
  83. var x: Double

    Permalink

    X-position of the new graphics object.

    X-position of the new graphics object.

    Definition Classes
    GraphicsPhysicsBody → DisplayObject
  84. var y: Double

    Permalink

    Y-position of the new graphics object.

    Y-position of the new graphics object.

    Definition Classes
    GraphicsPhysicsBody → DisplayObject
  85. var z: Double

    Permalink

    The z depth of this Game Object within its parent Group.

    The z depth of this Game Object within its parent Group. No two objects in a Group can have the same z value. This value is adjusted automatically whenever the Group hierarchy changes. If you wish to re-order the layering of a Game Object then see methods like Group.moveUp or Group.bringToTop.

    Definition Classes
    Core

Inherited from Reset

Inherited from PhysicsBody

Inherited from LifeSpan

Inherited from InWorld

Inherited from InputEnabled

Inherited from FixedToCamera

Inherited from Destroy

Inherited from Bounds

Inherited from AutoCull

Inherited from Angle

Inherited from Core

Inherited from pixijs.Graphics

Inherited from Container

Inherited from DisplayObject

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped