BoundMethods

BoundMethods

A class of static methods that would bound a mover to a rectangle in various ways. This class is utilized by classes that have a _wallObject Rectangle that can be set, and a boundMethod that can be set, which by default is set to one of these methods.


Constructor

new BoundMethods()

All methods of this class are static.

Methods

(static) bounceOff(mover, boundObejct)

Bounces the mover off of the boundObject

Parameters:
Name Type Description
mover Mover

a Mover or Object with x y width height properties

boundObejct Rectangle

(static) boundTo(mover, boundObejct)

Bounds the mover to the boundObject

Parameters:
Name Type Description
mover Mover

a Mover or Object with x y width height properties

boundObejct Rectangle

(static) wrapAround(mover, boundObejct)

When the move reaches the end of the boundObject it wraps back to the start.

Parameters:
Name Type Description
mover Mover

a Mover or Object with x y width height properties

boundObejct Rectangle