public class MyWorm { int segments = 60; float[] x = new float[segments]; float[] y = new float[segments]; float[] accelX = new float[segments]; float[] accelY = new float[segments]; float[] springing = new float[segments]; float[] damping = new float[segments]; // for food float fx, fy; float fCntrX, fCntrY; float fAngle, fSpeedX = .25, fSpeedY = .5; public MyWorm(){ this.segments = 60; // initialize array values for (int i=0; iwidth-15 || fCntrX<15 ){ fSpeedX*=-1; } if (fCntrY>height-15 || fCntrY<15 ){ fSpeedY*=-1; } } void createWorm(){ float[] deltaX = new float[segments]; float[] deltaY = new float[segments]; for (int i=0; i