You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Help Wanted] I have read the part of the book about the global position and local position. However I am stuck on using the containsPoint function of the PIXI.Sprite class. I can never get it to work correctly. Suppose I put everything into a parent container which is in stage. My player sprite is moving around using your camera centerOver function in GameUtilities. When I move it the player rotates towards the mouse position. I want to check if other sprite is intersecting with my sprite's rectangle clip. So I check if the anchor of other sprites are contained in my sprite's clip, which is also a rectangle sprite. The clip sprite is just next to my player sprite and facing to the mouse direction. If an examining sprite is contained in the clip I will change the color of the sprite. Sadly none of the sprites is contained in the clip sprite as I move my player sprite around the map.
I have also tried getBounds().contains(x, y), and getLocalBounds().contains(x, y). None of them works.
And I have tried your hitTestCircleRectangle() method in bump.js. This one does work, finally. However it is not very accurate. The color of the examining sprite changes but some of them are outside of the bound of my clip sprite, which is not far away but the distance is noticeable.
Any hint on this one?
The text was updated successfully, but these errors were encountered:
[Help Wanted] I have read the part of the book about the global position and local position. However I am stuck on using the
containsPoint
function of thePIXI.Sprite
class. I can never get it to work correctly. Suppose I put everything into a parent container which is in stage. My player sprite is moving around using your cameracenterOver
function inGameUtilities
. When I move it the player rotates towards the mouse position. I want to check if other sprite is intersecting with my sprite's rectangle clip. So I check if the anchor of other sprites are contained in my sprite's clip, which is also a rectangle sprite. The clip sprite is just next to my player sprite and facing to the mouse direction. If an examining sprite is contained in the clip I will change the color of the sprite. Sadly none of the sprites is contained in the clip sprite as I move my player sprite around the map.I have also tried
getBounds().contains(x, y)
, andgetLocalBounds().contains(x, y)
. None of them works.And I have tried your
hitTestCircleRectangle()
method inbump.js
. This one does work, finally. However it is not very accurate. The color of the examining sprite changes but some of them are outside of the bound of my clip sprite, which is not far away but the distance is noticeable.Any hint on this one?
The text was updated successfully, but these errors were encountered: