Sign in to follow this  

How do you show the hitbox of a sprite?

Recommended Posts

important note (for future users finding this question), as it's already working for you.


This only works in canvas mode (so you might have to initialize your game with Phaser.CANVAS instead of Phaser.AUTO)

Share this post

Link to post
Share on other sites

Just to help anyone that happens to need to do this to a group, you can call game.debug.body using forEachAlive but you need to set the context to game.debug otherwise you'll receive an error about there being no start() method in the existing context (since sprites have no start method, and the function game.debug.body assumes the scope of 'this' is the parent scope).



debugMode: function () {		game.debug.body(this.captain, "#9090ff", false);		this.enemy.forEachAlive(game.debug.body,game.debug,"#ff9090",false);		this.redLasers.forEach(game.debug.body,game.debug,"#dd00dd",false);		this.blueLasers.forEach(game.debug.body,game.debug,"#00dd00",false);	},

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.