Class: Graphics

Phaser. Graphics

Phaser.Graphics

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.

Properties:
Name Type Description
angle number

Gets or sets the angle of rotation in degrees.

Source:

cameraOffset

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.

Source:

exists

Properties:
Name Type Description
exists boolean

If exists = false then the Text isn't updated by the core game loop.

Default Value:
  • true
Source:

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

Properties:
Name Type Description
fixedToCamera boolean

Set to true to fix this Graphics to the Camera at its current world coordinates.

Source:

game

Properties:
Name Type Description
game Phaser.Game

A reference to the currently running Game.

Source:

name

Properties:
Name Type Description
name string

The user defined name given to this object.

Source:

type

Properties:
Name Type Description
type number

The const type of this object.

Source:

world

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.

Source:

Methods

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:
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Tue Feb 18 2014 03:01:22 GMT-0000 (GMT) using the DocStrap template.