cocos2d碰撞檢測

1. 代碼
CGRect rect1 = [self positionRect:sheep];
CGRect rect2
= [self positionRect:cow];
if (!CGRectIsNull(CGRectIntersection(rect1, rect2))) {
//handle collision
[sheep stopAction:jump_4ever];
}
2.然後 schedule 一個 1/30 或者 1/60 的 函數在裏面進行檢測。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章