Can I seek help with Sprite's containsPoint method here?
[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?
I've put it on https://codepen.io/caymanbruce/pen/WoBJYg?editors=0010 if you are interested.
@crazyyi Hi! containsPoint is something I never use, but you can find a discussion about it here:
http://www.html5gamedevs.com/topic/14536-hittest-in-v3/
Can anyone out there reading this give @crazyyi some help with his code?