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 context
Context The canvas context on which to render the debug information.
-
currentAlpha
-
- Default Value:
- 1
- Source:
Properties:
Name Type Description currentAlpha
number The current alpha the debug information will be rendered at.
-
currentX
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description currentX
Context The current X position the debug information will be rendered at.
-
currentY
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description currentY
number The current Y position the debug information will be rendered at.
-
font
-
- Default Value:
- '14px Courier'
- Source:
Properties:
Name Type Description font
string The font that the debug information is rendered in.
-
game
-
- Source:
Properties:
Name Type Description game
Phaser.Game A reference to the currently running Game.
-
lineHeight
-
- Source:
Properties:
Name Type Description lineHeight
number The line height between the debug text.
-
renderShadow
-
- Source:
Properties:
Name Type Description renderShadow
boolean 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 text
string The line of text to draw.
x
number The X value the debug info will start from.
y
number 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 camera
Phaser.Camera Description.
x
number X position of the debug info to be rendered.
y
number Y position of the debug info to be rendered.
color
string <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 circle
Phaser.Circle The Circle to render.
color
string <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 x
number X position of the debug info to be rendered.
y
number Y position of the debug info to be rendered.
color
string <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 sprite
Phaser.Sprite Description.
x
number X position of the debug info to be rendered.
y
number Y position of the debug info to be rendered.
color
string <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 x
number X position of the debug info to be rendered.
y
number Y position of the debug info to be rendered.
color
string <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 point
Phaser.Point The Point to render.
color
string <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 pointer
Phaser.Pointer Description.
hideIfUp
boolean <optional>
false Doesn't render the circle if the pointer is up.
downColor
string <optional>
'rgba(0,255,0,0.5)' The color the circle is rendered in if down.
upColor
string <optional>
'rgba(255,0,0,0.5)' The color the circle is rendered in if up (and hideIfUp is false).
color
string <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 sprite
Phaser.Point Description.
x
number X position of the debug info to be rendered.
y
number Y position of the debug info to be rendered.
color
string <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 quadtree
Phaser.QuadTree The quadtree to render.
color
string The color of the lines in the quadtree.
- Source:
-
renderRectangle(rect, color)
-
Renders a Rectangle.
Parameters:
Name Type Argument Description rect
Phaser.Rectangle The Rectangle to render.
color
string <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 sound
Phaser.Sound The sound object to debug.
x
number X position of the debug info to be rendered.
y
number Y position of the debug info to be rendered.
color
string <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 sprite
Phaser.Sprite Description.
color
string <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 sprite
Phaser.Sprite Description.
color
string <optional>
Color of the debug info to be rendered (format is css color string).
fill
boolean <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 sprite
Phaser.Sprite The sprite to be rendered.
x
number X position of the debug info to be rendered.
y
number Y position of the debug info to be rendered.
color
string <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 sprite
Phaser.Sprite The sprite to be rendered.
showText
boolean <optional>
false If true the x/y coordinates of each point will be rendered.
showBounds
boolean <optional>
false If true the bounds will be rendered over the top of the sprite.
color
string <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 sprite
Phaser.Sprite Description.
x
number X position of the debug info to be rendered.
y
number Y position of the debug info to be rendered.
color
string <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 sprite
Phaser.Sprite The sprite to be rendered.
x
number X position of the debug info to be rendered.
y
number Y position of the debug info to be rendered.
color
string <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 text
string The line of text to draw.
x
number X position of the debug info to be rendered.
y
number Y position of the debug info to be rendered.
color
string <optional>
Color of the debug info to be rendered (format is css color string).
font
string 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 sprite
Phaser.Sprite Description.
x
number X position of the debug info to be rendered.
y
number Y position of the debug info to be rendered.
color
string <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 x
number The X value the debug info will start from.
y
number The Y value the debug info will start from.
color
string The color the debug info will drawn in.
- Source:
-
stop()
-
Internal method that stops the debug output.
- Source: