Jump to content

How to display a thin outline of a rectangle shape sprite in Phaser?


caymanbruce
 Share

Recommended Posts

46 minutes ago, UncleAcid said:

Is lineStyle what you're looking for? http://phaser.io/docs/2.6.2/Phaser.Graphics.html#lineStyle Calling this before you call drawRect will result in a filled rectangle with an outline.

I use clear, lineStyle, drawRect and then endFill. and the parameters I use in drawRect is sprite.left, sprite.top, sprite.width, sprite.height. However when I scale the sprite it seems to only scale the texture/image attached to the sprite, the outline doesn't change with the scale.

Link to comment
Share on other sites

53 minutes ago, caymanbruce said:

I use clear, lineStyle, drawRect and then endFill. and the parameters I use in drawRect is sprite.left, sprite.top, sprite.width, sprite.height. However when I scale the sprite it seems to only scale the texture/image attached to the sprite, the outline doesn't change with the scale.

Ah, gotcha. I'm not sure, but you could try generating a texture from your graphics object to create a sprite with, instead of just using the graphics object?

Link to comment
Share on other sites

6 hours ago, caymanbruce said:

I use clear, lineStyle, drawRect and then endFill. and the parameters I use in drawRect is sprite.left, sprite.top, sprite.width, sprite.height.

That's the right way, you just have to redraw the graphic if the sprite changes size.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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