Cocos2d iPhone Non-Rectangular Sprite Touch Detection

前端 未结 3 558
Happy的楠姐
Happy的楠姐 2021-02-11 06:32

Have a project with a TRIANGLE shaped graphic in a sprite. I am arranging these sprites in a grid so that their rectangles are all overlapping. As sprites get touched their z-or

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-11 06:36

    I found this great tutorial that explains how to use two wonderful and indispensable utilities along with Cocos2d and Box2d to detect collisions (you could similarly use Chipmunk as well). You could use them to setup your program to detect touches in the same way he detects collisions.

    http://www.raywenderlich.com/606/how-to-use-box2d-for-just-collision-detection-with-cocos2d-iphone

    Here's the link to Zwoptexapp - Helps you setup the plist files for your sprites/spritesheet.

    http://www.zwoptexapp.com/

    Here's the link to VertexHelper - Allows you to trace the outline of your sprite and then translates the outline into code that you can paste into your project and use with Box2d, Chipmunk, etc.

    http://www.springenwerk.com/2010/02/introducing-vertexhelper-for-box2d.html

    I am still learning Cocos2d and Box2d myself and Ray's Tutorials have been immensely helpful to me. I hope they help you too!

提交回复
热议问题