API Docs for: 0.3.0
Show:

Collision.CollisionSegment Class

The CollisionSegment class allow you to define a segment to test collision width other segments and collision circles.

Constructor

Collision.CollisionSegment

(
  • x1
  • y1
  • x2
  • y2
)

Parameters:

  • x1 Number

    the x coordinate of the first point of the segment

  • y1 Number

    the y coordinate of the first point of the segment

  • x2 Number

    the x coordinate of the second point of the segment

  • y2 Number

    the y coordinate of the second point of the segment

Item Index

Properties

Methods

isCollidingCircle

(
  • circle
)
Boolean

The isCollidingCircle method allow you to test the collision beetween the current object and the circle object

Parameters:

  • circle CollisionCircle

    the CollisionCircle to test the interection with the CollisionSegment.

Returns:

Boolean: return true if circle is colliding the current CollisionSegment.

isCollidingSegment

(
  • segment
)
Boolean

The isCollidingSegment method allow you to test if the current segment is colliding another segment.

Parameters:

  • segment CollisionSegment

    the CollisionSegment to test if is colliding the current collision segment object.

Returns:

Boolean: return true if segment is colliding the current CollisionSegment.

Properties

px

Number

the x coordinate of the first point of the CollisionSegment

py

Number

the y coordinate of the first point of the CollisionSegment

vector

Vector2D

vector representing the segment (from x1;y2 to x2;y2)