Hitbox

Hitbox

Description:
  • The Hitbox interface is used by the Hittable mixin. If a Hitbox is attached to a Hittable instance object, hit detection will be performed on the object when the user's first input in an interaction sequence touches down. Note that a class implementing the Hitbox interface should not worry about applying transformations to the points it receives. That will be taken care of by the Hittable mixin. To produce accurate results, a Hitbox should behave as if the object it is associated with is positioned at x = 0, y = 0, with scale = 1 and rotation = 0. That is, with the identity transformation.
Source:
The Hitbox interface is used by the Hittable mixin. If a Hitbox is attached to a Hittable instance object, hit detection will be performed on the object when the user's first input in an interaction sequence touches down. Note that a class implementing the Hitbox interface should not worry about applying transformations to the points it receives. That will be taken care of by the Hittable mixin. To produce accurate results, a Hitbox should behave as if the object it is associated with is positioned at x = 0, y = 0, with scale = 1 and rotation = 0. That is, with the identity transformation.

Methods

contains(point) → {boolean}

Description:
  • Report whether the given (x,y) point is contained within the shape.
Source:
Parameters:
Name Type Description
point module:shared.Point2D The point to test.
Returns:
True if the given point is inside the shape, false otherwise.
Type
boolean