球和桨的角落碰撞!! iOS版

时间:2012-10-10 06:45:02

标签: ios collision

当球从角落或左右两侧击中球拍时,球从一侧进入球拍并从另一侧射出球..我该如何解决这个问题?感谢..

我的代码:

if (CGRectIntersectsRect(ball.frame,paddle.frame))
{
            [self bounceBall]; 
}

- (void) bounceBall
 {
    direction.x *= 1;
    direction.y *=-1;
}

enter image description here

1 个答案:

答案 0 :(得分:0)

This将有助于您解决上述问题。