new Graphics(game, x, y)
Creates a new Graphics
object.
Parameters:
Name | Type | Description |
---|---|---|
game |
Phaser.Game | Current game instance. |
x |
number | X position of the new graphics object. |
y |
number | Y position of the new graphics object. |
- Source:
Members
-
angle
-
Indicates the rotation of the Graphics, 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 use the property Sprite.rotation instead.
- Source:
Properties:
Name Type Description angle
number Gets or sets the angle of rotation in degrees.
-
cameraOffset
-
- Source:
Properties:
Name Type Description cameraOffset
Phaser.Point If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.
-
exists
-
- Default Value:
- true
- Source:
Properties:
Name Type Description exists
boolean If exists = false then the Text isn't updated by the core game loop.
-
fixedToCamera
-
An Graphics that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Graphics.cameraOffset. Note that the cameraOffset values are in addition to any parent in the display list. So if this Graphics was in a Group that has x: 200, then this will be added to the cameraOffset.x
- Source:
Properties:
Name Type Description fixedToCamera
boolean Set to true to fix this Graphics to the Camera at its current world coordinates.
-
game
-
- Source:
Properties:
Name Type Description game
Phaser.Game A reference to the currently running Game.
-
name
-
- Source:
Properties:
Name Type Description name
string The user defined name given to this object.
-
type
-
- Source:
Properties:
Name Type Description type
number The const type of this object.
-
world
-
- Source:
Properties:
Name Type Description world
Phaser.Point The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container.
Methods
-
destroy()
-
Destroy this Graphics instance.
- Source:
-
drawPolygon()
-
/* Draws a {Phaser.Polygon} or a {PIXI.Polygon} filled
- Source:
-
postUpdate()
-
Automatically called by World.postUpdate.
- Source:
-
preUpdate()
-
Automatically called by World.preUpdate.
- Source:
-
update()
-
Override and use this function in your own custom objects to handle any update requirements you may have.
- Source: