Sign in to follow this  

How is Sprite's width and height calculated?

Recommended Posts

I build my sprites from a canvas object I created, which is bascially a circle with a radius at most 28 pixels. I built it with Canvas API.

Then I use Texture.fromCanvas(canvas);

Then Sprite.from(texture); 

However when I try to watch the sprite's width and height, I get 300 and 150. I wonder how are these two values calculated. What I need is a sprite as big as 30 x 30 at most. Why does it give me a 300 x 150 sprite? If I need to do some hitTest check I can't use the sprite's width and height directly. I have to use the radius of my canvas object.This is very inconvenient.

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.