Threedy Posted July 21, 2016 Share Posted July 21, 2016 This may be a ridiculous simple question, but I can't figure this one out... I tried drawing a circle using the following function: drawCircle(x, y, radius) Where x and y are according to the documentation of Pixi: Quote The X/Y coordinate of the center of the circle If I want to change the position later, I can use the: circle.position.x or circle.position.y method. If I set both at (2,2) (position.x = 2 and position.y = 2), I see that the position is different than the one I used to create the circle with: drawCircle(2,2,1). I then don't understand the API's ''the x,y coordinate of the center of the circle''.. Wouldn't that be the initial position of that circle anyway? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 21, 2016 Share Posted July 21, 2016 The thing is, what you pass in drawCircle is not a position, its coordinates of the circle relative to the graphics you are creating. So you have to use "graphics.drawCircle(0, 0, 1); graphics.position.set(1,1);" To understand why API works that way, imagine that graphics has two circles in it. Which of two circles position will appear in "graphics.position"? Threedy 1 Quote Link to comment Share on other sites More sharing options...
Threedy Posted July 22, 2016 Author Share Posted July 22, 2016 22 hours ago, ivan.popelyshev said: The thing is, what you pass in drawCircle is not a position, its coordinates of the circle relative to the graphics you are creating. So you have to use "graphics.drawCircle(0, 0, 1); graphics.position.set(1,1);" To understand why API works that way, imagine that graphics has two circles in it. Which of two circles position will appear in "graphics.position"? Thank you Ivan! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.