Current game instance.
X position of the new text object.
Y position of the new text object.
The actual text that will be written.
The style properties to be set on the Text.
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.
The Game Object or Rectangle with which to align this Game Object to. Can also include properties such as World.bounds or Camera.view
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
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.
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.
This Game Object.
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.
Phaser.Component.LifeSpan#alive
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.
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.
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.
The blend mode to be applied to the sprite.
The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode. Warning: You cannot have a blend mode and a filter active on the same Sprite. Doing so will render the sprite invisible.
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.
The sum of the y and height properties.
The sum of the y and height properties.
This is the same as y + height - offsetY
.
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)
.
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)
.
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.
A debug flag designed for use with Game.enableStep
.
A debug flag designed for use with Game.enableStep
.
Returns the delta x value.
Returns the delta x value. The difference between world.x now and in the previous frame. The value will be positive if the Game Object has moved to the right or negative if to the left.
Returns the delta y value.
Returns the delta y value. The difference between world.y now and in the previous frame. The value will be positive if the Game Object has moved down or negative if up.
Returns the delta z value.
Returns the delta z value. The difference between rotation now and in the previous frame. The delta value.
Base destroy method for generic display objects.
Base destroy method for generic display objects.
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.
Should every child of this object have its destroy method called as well?
Destroy the BaseTexture this Game Object is using? Note that if another Game Object is sharing the same BaseTexture it will invalidate it.
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
The left coordinate of the Game Object.
The left coordinate of the Game Object.
This is the same as x - offsetX
.
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.
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.
The right coordinate of the Game Object.
The right coordinate of the Game Object.
This is the same as x + width - offsetX
.
The maximum scale this Game Object will scale up to.
The maximum scale this Game Object will scale up to.
It allows you to prevent a parent from scaling this Game Object higher than the given value.
Set it to null to remove the limit.
The minimum scale this Game Object will scale down to.
The minimum scale this Game Object will scale down to.
It allows you to prevent a parent from scaling this Game Object lower than the given value.
Set it to null to remove the limit.
Sets the scaleMin and scaleMax values.
Sets the scaleMin and scaleMax values. These values are used to limit how far this Game Object will scale based on its parent. For example if this Game Object has a minScale value of 1 and its parent has a scale value of 0.5, the 0.5 will be ignored and the scale value of 1 will be used, as the parents scale is lower than the minimum scale this Game Object should adhere to. By setting these values you can carefully control how Game Objects deal with responsive scaling. If only one parameter is given then that value will be used for both scaleMin and scaleMax: setScaleMinMax(1) = scaleMin.x, scaleMin.y, scaleMax.x and scaleMax.y all = 1 If only two parameters are given the first is set as scaleMin.x and y and the second as scaleMax.x and y: setScaleMinMax(0.5, 2) = scaleMin.x and y = 0.5 and scaleMax.x and y = 2 If you wish to set scaleMin with different values for x and y then either modify Game Object.scaleMin directly, or pass null for the maxX and maxY parameters. Call setScaleMinMax(null) to clear all previously set values.
The minimum horizontal scale value this Game Object can scale down to.
The minimum vertical scale value this Game Object can scale down to.
The maximum horizontal scale value this Game Object can scale up to.
The maximum vertical scale value this Game Object can scale up to.
Enable or disable texture smoothing for this Game Object.
Enable or disable texture smoothing for this Game Object. It only takes effect if the Game Object is using an image based texture. Smoothing is enabled by default.
The style properties to be set on the Text.
The actual text that will be written.
The y coordinate of the Game Object.
The y coordinate of the Game Object.
This is the same as y - offsetY
.
The callback that will apply any scale limiting to the worldTransform.
The callback that will apply any scale limiting to the worldTransform.
The context under which transformCallback
is called.
The context under which transformCallback
is called.
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.
The position of the Game Object on the x axis relative to the local coordinates of the parent.
The position of the Game Object on the x axis relative to the local coordinates of the parent.
The position of the Game Object on the y axis relative to the local coordinates of the parent.
The position of the Game Object on the y axis relative to the local coordinates of the parent.
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.
Create a new game object for displaying Text.
This uses a local hidden Canvas object and renders the type into it. It then makes a texture from this for rendering to the view. Because of this you can only display fonts that are currently loaded and available to the browser: fonts must be pre-loaded.