Jump to content

Draw Debug Geometry Below Sprites


MadMonkey119
 Share

Recommended Posts

Hi, I introduced myself to Phaser yesterday and have been having fun learning and playing with it. I am currently drawing a rectangle to use for a game's background.

 

To draw it I first create the rectangle 

new Phaser.Rectangle(0, 0, 480, 0)

then use

 game.debug.geom()

I want to now display a sprite above the rectangle background but I can't find a way to influence the order in which they are drawn.

 

Thank you very much!

Link to comment
Share on other sites

I have solved my own problem by using graphics rather than drawing debug geometry. Graphics can be used to draw rectangles, circles, etc so it was a much better implementation than debug geometry.

 

By calling

graphics = game.add.graphics(0, 0);

before adding my sprites to the screen it draws the graphics below the sprites.

Link to comment
Share on other sites

  • 2 weeks later...

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...