new Debug(game)
A collection of methods for displaying debug information about game objects. Phaser.Debug requires a CANVAS game type in order to render, so if you've got your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL doesn't kick in, then the Debug functions will all display.
Parameters:
| Name | Type | Description |
|---|---|---|
game |
Phaser.Game | A reference to the currently running game. |
- Source:
Members
-
context
-
- Source:
Properties:
Name Type Description contextContext The canvas context on which to render the debug information.
-
currentAlpha
-
- Default Value:
- 1
- Source:
Properties:
Name Type Description currentAlphanumber The current alpha the debug information will be rendered at.
-
currentX
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description currentXContext The current X position the debug information will be rendered at.
-
currentY
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description currentYnumber The current Y position the debug information will be rendered at.
-
font
-
- Default Value:
- '14px Courier'
- Source:
Properties:
Name Type Description fontstring The font that the debug information is rendered in.
-
game
-
- Source:
Properties:
Name Type Description gamePhaser.Game A reference to the currently running Game.
-
lineHeight
-
- Source:
Properties:
Name Type Description lineHeightnumber The line height between the debug text.
-
renderShadow
-
- Source:
Properties:
Name Type Description renderShadowboolean Should the text be rendered with a slight shadow? Makes it easier to read on different types of background.
Methods
-
line(text, x, y)
-
Internal method that outputs a single line of text.
Parameters:
Name Type Description textstring The line of text to draw.
xnumber The X value the debug info will start from.
ynumber The Y value the debug info will start from.
- Source:
-
renderCameraInfo(camera, x, y, color)
-
Render camera information including dimensions and location.
Parameters:
Name Type Argument Default Description cameraPhaser.Camera Description.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderCircle(circle, color)
-
Renders a Circle.
Parameters:
Name Type Argument Description circlePhaser.Circle The Circle to render.
colorstring <optional>
Color of the debug info to be rendered (format is css color string).
- Source:
-
renderInputInfo(x, y, color)
-
Render debug information about the Input object.
Parameters:
Name Type Argument Default Description xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderLocalTransformInfo(sprite, x, y, color)
-
Render the Local Transform information of the given Sprite.
Parameters:
Name Type Argument Default Description spritePhaser.Sprite Description.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderPixel(x, y, color)
-
Renders a single pixel.
Parameters:
Name Type Argument Description xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
Color of the debug info to be rendered (format is css color string).
- Source:
-
renderPoint(point, color)
-
Renders a Point object.
Parameters:
Name Type Argument Description pointPhaser.Point The Point to render.
colorstring <optional>
Color of the debug info to be rendered (format is css color string).
- Source:
-
renderPointer(pointer, hideIfUp, downColor, upColor, color)
-
Renders the Pointer.circle object onto the stage in green if down or red if up along with debug text.
Parameters:
Name Type Argument Default Description pointerPhaser.Pointer Description.
hideIfUpboolean <optional>
false Doesn't render the circle if the pointer is up.
downColorstring <optional>
'rgba(0,255,0,0.5)' The color the circle is rendered in if down.
upColorstring <optional>
'rgba(255,0,0,0.5)' The color the circle is rendered in if up (and hideIfUp is false).
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderPointInfo(sprite, x, y, color)
-
Renders Point coordinates in the given color.
Parameters:
Name Type Argument Default Description spritePhaser.Point Description.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderQuadTree(quadtree, color)
-
Visually renders a QuadTree to the display.
Parameters:
Name Type Description quadtreePhaser.QuadTree The quadtree to render.
colorstring The color of the lines in the quadtree.
- Source:
-
renderRectangle(rect, color)
-
Renders a Rectangle.
Parameters:
Name Type Argument Description rectPhaser.Rectangle The Rectangle to render.
colorstring <optional>
Color of the debug info to be rendered (format is css color string).
- Source:
-
renderSoundInfo(sound, x, y, color)
-
Render Sound information, including decoded state, duration, volume and more.
Parameters:
Name Type Argument Default Description soundPhaser.Sound The sound object to debug.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderSpriteBody(sprite, color)
-
Renders just the Sprite.body bounds.
Parameters:
Name Type Argument Description spritePhaser.Sprite Description.
colorstring <optional>
Color of the debug info to be rendered (format is css color string).
- Source:
-
renderSpriteBounds(sprite, color, fill)
-
Renders just the full Sprite bounds.
Parameters:
Name Type Argument Default Description spritePhaser.Sprite Description.
colorstring <optional>
Color of the debug info to be rendered (format is css color string).
fillboolean <optional>
false If false the bounds outline is rendered, if true the whole rectangle is rendered.
- Source:
-
renderSpriteCollision(sprite, x, y, color)
-
Render Sprite collision.
Parameters:
Name Type Argument Default Description spritePhaser.Sprite The sprite to be rendered.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderSpriteCorners(sprite, showText, showBounds, color)
-
Renders the corners and point information of the given Sprite.
Parameters:
Name Type Argument Default Description spritePhaser.Sprite The sprite to be rendered.
showTextboolean <optional>
false If true the x/y coordinates of each point will be rendered.
showBoundsboolean <optional>
false If true the bounds will be rendered over the top of the sprite.
colorstring <optional>
'rgb(255,0,255)' The color the text is rendered in.
- Source:
-
renderSpriteInfo(sprite, x, y, color)
-
Render debug infos (including name, bounds info, position and some other properties) about the Sprite.
Parameters:
Name Type Argument Default Description spritePhaser.Sprite Description.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderSpriteInputInfo(sprite, x, y, color)
-
Render Sprite Input Debug information.
Parameters:
Name Type Argument Default Description spritePhaser.Sprite The sprite to be rendered.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderText(text, x, y, color, font)
-
Render text.
Parameters:
Name Type Argument Description textstring The line of text to draw.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
Color of the debug info to be rendered (format is css color string).
fontstring The font of text to draw.
- Source:
-
renderWorldTransformInfo(sprite, x, y, color)
-
Render the World Transform information of the given Sprite.
Parameters:
Name Type Argument Default Description spritePhaser.Sprite Description.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
start(x, y, color)
-
Internal method that resets and starts the debug output values.
Parameters:
Name Type Description xnumber The X value the debug info will start from.
ynumber The Y value the debug info will start from.
colorstring The color the debug info will drawn in.
- Source:
-
stop()
-
Internal method that stops the debug output.
- Source: