function Jelly() {
this.path = new Path();
this.location = new Point( -100 , Math.random() * (view.size.height * 0.5) );
this.velocity = new Point( 0, 0 );
this.acceleration = new Point( 0, 0 );
....
this.init = function() {
// Creates body path
for ( var i = 0; i < pathRes; i++ ) {
var theta = angle * i;
var thetaUp = theta - (Math.PI / 2);
var point = new Point({x: 0, y: 0});
// Upper side of the body
if ( theta < wrapAngle ) {
point.x = Math.cos( thetaUp ) * pathRadius;
point.y = Math.sin( thetaUp ) * pathRadius;
}
// Inner side
else if ( theta > wrapAngle && theta + (angle * 2) < wrapAngle + Math.PI ) {
point.x = Math.cos( thetaUp ) * pathRadius;
point.y = Math.sin( thetaUp ) * ((-pathRadius * 0.85) + pathRadius * 1.25);
}
// The other upper side of the body
else {
point.x = Math.cos( thetaUp ) * pathRadius;
point.y = Math.sin( thetaUp ) * pathRadius;
}
pathPoints[i] = point;
this.path.add( point );
}