the-simian Posted June 22, 2018 Share Posted June 22, 2018 Hello, I wanted to post here and ask about setting the game so you can debug physics. Firstly: I am doing what I see in a lot of the examples, which is setting the debug property in the game config. I've added a snippet of my config. I'm not 100% sure why, but this doesn't draw anything. I did, with some looking around, figure out how to draw a layer over the tilemap itself, but I really need to also draw over the player as well. plus those lines indicating velocity seem useful. The code that does correctly draw over the tilemap I have also included. My guess is that I am doing something obviously incorrect. I seem to recall that for an older version of Phaser I needed a plugin to make the debug layer work correctly. Is that still true? If so what's the 'most correct' one to include? Could something be interfering? I do have an animation on my player sprite, and there's a background layer too, but disabling the background still did not help. Thank you for any help! //If i include this in my create() method I get some desirable results this.map.renderDebug(this.debugGraphics, { tileColor: null, collidingTileColor: new Phaser.Display.Color(243, 134, 48, 128), faceColor: new Phaser.Display.Color(40, 39, 37, 255) }); /// This is my game config, it doesn't seem to do anything when I set debug: true const config = { type: Phaser.AUTO, width: constants.WIDTH, height: constants.HEIGHT, physics: { default: 'arcade', arcade: { gravity: { y: 400 }, debug: true //does nothing. } }, scene: [StartScene, GameScene], pixelArt: true, antialias: false, callbacks: { postBoot: game => { game.renderer.addPipeline('Custom', new CustomPipeline(game)); } } }; const game = new Phaser.Game(config); Link to comment Share on other sites More sharing options...
the-simian Posted June 23, 2018 Author Share Posted June 23, 2018 Ok i did some experimenting, and I was able to figure out that the debug would only draw for the first scene in set in a list of scenes. I am not sure why, but i'm happily debugging now change scene: [StartScene, GameScene], to scene: [GameScene], and that works just fine. Link to comment Share on other sites More sharing options...
samme Posted June 23, 2018 Share Posted June 23, 2018 What is this.debugGraphic? Link to comment Share on other sites More sharing options...
the-simian Posted June 23, 2018 Author Share Posted June 23, 2018 So sorry samme, I left that out. In the create method I also have create the map and the debugGraphics: The debugGraphics draws on top of my tilemap, and it indicates the parts you can collide with. It seems to be working on, and since I removed them ultiple scenes, so does the Arcade physics debug - so everything works now. I am not sure why the arcade physics debug did not work for every scene, not just the first scene this.map = this.make.tilemap({ key: 'map' }); this.debugGraphics = this.add.graphics(); Link to comment Share on other sites More sharing options...
aylictal Posted June 25, 2018 Share Posted June 25, 2018 Yeah to make a manual debug visualizer, you have to opt to using this.add.graphics() because the phaser 2 version hasn't been implemented yet afaik. Link to comment Share on other sites More sharing options...
Recommended Posts