Cocos Creator API

1.4.x

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

Intersection static

Module: cc

Intersection helper class

Methods

lineLine
(
  • a1
  • a2
  • b1
  • b2
)
boolean

Test line and line

name type description
a1 Vec2

The start point of the first line

a2 Vec2

The end point of the first line

b1 Vec2

The start point of the second line

b2 Vec2

The end point of the second line

returns:

type: boolean

lineRect
(
  • a1
  • a2
  • b
)
boolean

Test line and rect

name type description
a1 Vec2

The start point of the line

a2 Vec2

The end point of the line

b Rect

The rect

returns:

type: boolean

linePolygon
(
  • a1
  • a2
  • b
)
boolean

Test line and polygon

name type description
a1 Vec2

The start point of the line

a2 Vec2

The end point of the line

b [Vec2]

The polygon, a set of points

returns:

type: boolean

rectRect
(
  • a
  • b
)
boolean

Test rect and rect

name type description
a Rect

The first rect

b Rect

The second rect

returns:

type: boolean

rectPolygon
(
  • a
  • b
)
boolean

Test rect and polygon

name type description
a Rect

The rect

b <