Help debugging through Physics with Phaser 3

Recommended Posts


I'm working with Phaser 3.12.0 and I'm attempting to experiment with debugging in general.  I am failing to get any debug information with the following game code....


const config = {
  type: Phaser.AUTO,
  width: 640,
  height: 480,
  backgroundColor: "#000044",
  // physics settings
  physics: {
    // we are using matter.js engine that is built into Phaser
    default: "matter",
    arcade: {
      debug: true

  scene: {
    init: init,
    preload: preload,
    create: create,

let game = new Phaser.Game(config);

function init() {
  console.log('the initializer');

function preload() {
  console.log('the preload');
  this.load.image("crate", "game04/media/crate.png");

function create() {
  console.log('the the update');, -200, game.config.width, game.config.height + 200);

  // waiting for user input
  this.input.on("pointerdown", function (pointer) {
    console.log('we are clicking for an event to fire');

    // getting Matter bodies under the pointer
    var bodiesUnderPointer = Phaser.Physics.Matter.Matter.Query.point(, pointer);

    // if there isn't any body under the pointer...
    if (bodiesUnderPointer.length == 0) {

      // create a crate
      this.matter.add.sprite(pointer.x, pointer.y, "crate");

    // this is where I wanted to remove the crate. Unfortunately I did not find a quick way to delete the Sprite
    // bound to a Matter body, so I am setting it to invisible, then remove the body.
    else {
      bodiesUnderPointer[0].gameObject.visible = false;[0])
  }, this);

function render() {
  // Camera
  game.debug.cameraInfo(, 32, 32);


I guess I just need a basic understanding of how to debug through Phaser 3.  I borrowed some examples from the labs and placed them in here, in hope to see something.  But like I said, absolutely no debug information is being displayed.  What would be a potential reason?



Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.