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.
我的场景中有 20 个精灵。当我移动一个精灵时,我想知道被触摸的精灵是什么。当我移动的精灵被触摸时。
谁能帮我写代码。
您可以使用,
for(int i = 0; i<20; i++) { CCSprite *currentSprite = (CCSprite *)[self getChildByTag:i+tagOffset]; if(CGRectIntersectsRect([movingSprite boundingBox],[currentSprite boundingBox])) { // current sprite touched Break; } }