//****************************************************************************** // jvb.java: Applet // // Conversion of DDVectorBalls. A.J.Buchanan 5/98. First Java program! // // Still under development!!! // //****************************************************************************** import java.applet.*; import java.awt.*; import java.net.URL; import java.util.*; import java.awt.image.*; // todo: make quicker!!!! // class VbSprite { int sx,sy; int fr; Image imSpriteA[]; int w,h; int numFrames; // Construct sprite from array of frames VbSprite( Image im[], int iFrames ) { numFrames = iFrames; w = im[0].getWidth( null ); h = im[0].getHeight( null ); imSpriteA = new Image[iFrames]; for ( int i=0; i z ) if ( null != pRight ) { pRight.TreeWalkAndDraw( gContext ); } // Draw. // DBG Version //Color cc[] = { Color.blue, Color.magenta, Color.red, Color.white, Color.green, Color.yellow }; //gContext.setColor( cc[frame] ); // DBG!! //gContext.fillRect( ScrX-1, ScrY-1, 2, 2 ); //gContext.fillOval( ScrX-8, ScrY-8, 16, 16); // Shoulb be 32 not 16! // Draw Sprite.Draw( gContext, ScrX, ScrY, frame ); // Walk Left Side ( < z ) if ( null != pLeft ) { pLeft.TreeWalkAndDraw( gContext ); } } } // Null Object, You must create an object, using one of the derived classes abstract class VbObject { final static int ANIM_NONE = 0; final static int ANIM_SINUS = 1; final static int ANIM_SWOOSH = 2; final static int ANIM_WOBBLE = 3; private final static int VB_ZOFF = 520; private final static int VB_K = 512; protected int iNumBalls; // No Of Balls protected VbBall Balls[]; // Pointer to balls protected int Animate; // Animation constant protected int value1; // Misc protected int value2; // Misc protected int value3; // Misc protected int value4; // Misc protected int value5; // Misc void SetSprite( VbSprite Sprite ) { // Sets same for all balls for ( int i=0; i