Jump to content

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


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

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...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...