API Docs for: 0.3.0
Show:

Collision.CollisionCircle Class

The CollisionCircle class allow you to create a CollisionCircle to test intersections with other collision objects like circles, segments or boxes.

Constructor

Collision.CollisionCircle

(
  • x
  • y
  • radius
)

Parameters:

  • x Number

    the x coordinate of the CollisionCircle

  • y Number

    the y coordinate of the CollisionCircle

  • radius Number

    the radius of the CollisionCircle

Methods

isCollidingBox

(
  • box
)
Boolean

The isCollidingBox method allow you to test if the current CollisionCircle is colliding the CollidingBox in parameter.

Parameters:

  • box CollisionBox

    the CollidingBox to test collision with.

Returns:

Boolean: returns true if the current CollisionCircle is colliding the box; otherwise, it returns false

isCollidingCircle

(
  • circle
)
Boolean

The method is CollidingCircle allow you to test if two circles are Colliding. Let's see an example :

 var circle = new CollisionCircle(x, y, radius);
 var circle2 = new CollisionCircle(x2, y2, radius2);
 var result = circle.isCollidingCircle(circle2);

If result is true, so the circle object is colliding the circle2 object. If result if false, so the circle object is not colliding the circle2 object.

Parameters:

  • circle CollisionCircle

    the CollisionCircle to test collision with.

Returns:

Boolean: return true if the two circles are colliding, otherwise return false.

isCollidingSegment

(
  • ax
  • ay
  • bx
  • by
)
Boolean

The isCollidingSegment method allow you to test if the CollisionCircle is Colliding a segment

Parameters:

  • ax Number

    the x coordinate of the first point of the segment to test intersection with.

  • ay Number

    the y coordinate of the first point of the segment to test intersection with.

  • bx Number

    the x coordinate of the second point of the segment to test intersection with.

  • by Number

    the y coordinate of the second point of the segment to test intersection with.

Returns:

Boolean: returns true if the current CollisionCircle is colliding the segment. Otherwise return false.

isPointInside

(
  • px
  • py
)
Boolean

The isPointInside method allow you to test if a point is inside the current circle

Parameters:

  • px Number

    the x coordinate of the point

  • py Number

    the y coordinate of the point

Returns:

Boolean: return true if the point is inside the Circle, otherwise it returns false.

Properties

radius

Number

type

String

type of Collision object