Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一些关于静态物体的多重检测的问题。
如何检测或区分多个静态物体?在我的游戏中,我使用平铺地图并在静态主体中创建 3 个对象。与玩家精灵碰撞时如何区分彼此?
提前致谢
你可以通过2种方式做到这一点。
id obj1 = (id)bodyA->GetUserData(); if( ((CCSprite*)obj1).tag == kTagStaticBody1 ) //check ur sprite tag { }
//OR: 用于识别类
id obj1 = (id)bodyA->GetUserData(); if([obj1 isKindOfClass:[MyActor class]]) { }