Changing SKSpriteNode Frame? Isometric challenges

徘徊边缘 提交于 2019-12-05 12:46:00

I have been deep down this path, I can say it is a LOT easier to implement your own hit detection than trying to force spritekit into doing what you're planning.

It's not THAT hard tough. Simply do a custom hittest function on your tiles and loop through them all on mouse down and test them all.

There's a pretty easy algorithm for testing your shape but in all fairness you can probably just test for the inner circle of the diamond shape, so simply test if the distance to the center of the sprite is < radius of click circle. Easy peasy.

The SKPhysicsBody can be created by path [SKPhysicsBody bodyWithEdgeLoopFromPath:(CGPath)]; You will have to tweak the path to get the shape you want, but if you are only using it for tiles, it should be fine.

Check if Node.PhysicsBody contains touchpoint.

If you require the method let me know.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!