Class: Bouncer

hcje/sprites.Bouncer(actorDims, boundary)

Bouncer class which adjusts the Dynamics of a Sprite so that it bounces within predefined bounds.

Constructor

new Bouncer(actorDims, boundary)

Construct bouncer with the specified boundary.

Parameters:
Name Type Description
actorDims module:hcje/utils~Dimensions

Dimensions of the object being moved.

boundary module:hcje/utils~RectData

Movement boundary. The object will bounce within the boundary.

Implements:
Source:

Methods

limit(target, dynamics)

Function to limit the Dynamics instance. The limiter might be adjusting the dynamics to apply constraints such as boundarys within which to bounce, or even more complex dynamics adjustments beyond just simple velocity and acceleration. Note that the limit method is called after the standard application of velocity and acceleration.

Parameters:
Name Type Description
target module:hcje/sprites.Sprite

The target object to limit.

dynamics module:hcje/sprites.Dynamics

The associated dynamics.

Implements:
Source: