[Cocos2d-js tutorial] some common functions in cocos2d-js, cocos2d-js tutorial
This article by qinning199 original, reproduced Please note: http://www.cocos2dx.net/post/223
1. cc. rectIntersectsRect (ra, rb) checks whether two rectangles are intersecting. If yes, true is returned.
Use Case:
Var rectA = cc. rect (0, 0, 5, 10 );
Var rectB = cc. rect (4, 9, 5, 10 );
Var r = cc. rectIntersectsRect (rectA, rectB );
If (! R) throw "Fail rectIntersectsRect 1 ";
2. cc. rectContainsPoint (rect, point) checks whether a rectangle contains a vertex. If so, true is returned.
3. cc. pointEqualToPoint (point1, point2) checks whether two vertices are equal and returns true if they are equal.
4. cc. rectEqualToRect (rect1, rect2) checks whether two rectangles are equal
5. cc. _ rectEqualToZero (rect) determines whether the rectangle is a 0 matrix.
6. cc. rectOverlapsRect (rectA, rectB) to determine whether the two rectangles partially overlap
7. cc. rectIntersection (rectA, rectB) returns the overlapping part of the two rectangles.
8. cc. rectUnion (rectA, rectB) returns the smallest rectangle containing the two rectangles.