[Vorbis-dev] file

abot saleh saleh_bu_19 at yahoo.com
Sun Aug 14 18:46:05 PDT 2005


hi
i'm saleh
i want it so imediatly please guid me
 
my program shuld have a thread that
 the 4 or more ducky picture fly in sky
then 1 gun exist in button of picture that 
it change place which time then with
press the (space key) shut the bird
then give him point
 
and have a background from nature that move by the time
thanks from your giving answer to me
bye
                           
                                     Gun Pro
package tamrin;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class test2 extends Applet {
    int c = 225, d = 260,v=620;
    int a = 293, b = 530,bb=530;
    int p = 220, q = 640;
    int n, m, i;
    public void init() {
        n = (int) (Math.random() * 660 - 100);
        m = (int) (Math.random() * 350 - 100);
        this.setSize(600, 670);
        this.setBackground(Color.CYAN);
    }
    public void paint(Graphics screen) {
        Graphics2D screen2D = (Graphics2D) screen;
        screen2D.setColor(Color.RED);
        screen2D.fillOval(a, bb,15,15);
        screen2D.setColor(Color.BLACK);
        screen2D.fillRoundRect(a, b, 15, 150, 10, 10);
        screen2D.fillRoundRect(p, q, 160, 160, 15, 15);
        screen2D.fillOval(c,v,150,150);
    }
        public test2() {
            try {
                jbInit();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        private void jbInit() throws Exception {
            this.addKeyListener(new test2_this_keyAdapter(this));
        }
        void this_keyPressed(KeyEvent e) {
            if (e.getKeyCode() == e.VK_RIGHT) {
                a += 10;
              //  b += 10;
                c += 10;
              //  d += 10;
                p += 10;
             //   q += 10;
            }
            if (e.getKeyCode() == e.VK_SPACE) {
                while(bb==0){
                    bb -= 10;
                }
            }
            if (e.getKeyCode() == e.VK_LEFT) {
             //   while (a == 2) {
                    a -= 10;
                    //   b-=10;
                    c-=10;
                    //   d-=10;
                    //   q-=10;
                    p -= 10;
              //  }
            }
            repaint();
        }
     }
     class test2_this_keyAdapter extends java.awt.event.KeyAdapter {
        test2 adaptee;
        test2_this_keyAdapter(test2 adaptee) {
            this.adaptee = adaptee;
        }
        public void keyPressed(KeyEvent e) {
            adaptee.this_keyPressed(e);
        }
}
************************************************************************************************************
                                 Main pro
package tamrin;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
public class asl extends Applet implements Runnable {
    int c = 290, d = 300;
    AudioClip a1;
    int n, m, i;
    Thread t = new Thread(this);
    Image picture[] = new Image[5];
    int totalpic = 0;
    int current = 0;
    int pause = 500;
    String imgText;
//*************************************************
     public void init() {
         n = (int) (Math.random() * 660 - 100);
         m = (int) (Math.random() * 350 - 100);
         this.setSize(600, 670);
         this.setBackground(Color.CYAN);
         t.start();
         a1 = getAudioClip(getDocumentBase(), "4.au");
         // a loop for give the pictures
         for (i = 1; i <= picture.length; i++) {
             picture[i] = this.getImage(this.getCodeBase(), "i.jpg");
         }
         String pauseText = null;
         pause = Integer.parseInt(pauseText);
         for (i = 0; i < 6; i++) {
             imgText = getParameter("image" + i);
             if (imgText != null) {
                 totalpic++;
                 picture[i] = this.getImage(this.getCodeBase(), imgText);
             } else {
                 totalpic++;
             }
         }
     }
//**********************************************
     public void paint(Graphics screen) {
         Graphics2D screen2D = (Graphics2D) screen;
         if (picture[i] != null) {
             screen2D.drawImage(picture[current], 0, 0, this);
         }
         screen2D.fillOval(225, 620, 150, 150);
         screen2D.setColor(Color.red);
         screen2D.fillOval(c, d, 20, 20); // c=290 , d=300
         screen2D.setColor(Color.BLACK);
         screen2D.fillRoundRect(293, 530, 15, 150, 10, 10);
         for (i = 0; i < 5; i++) {
             screen2D.drawImage(picture[i], m, n, 60, 40, this);
         }
     }
//**********************************************
     public void start() {
         if (t == null) {
             t = new Thread(this);
             t.start();
         }
     }
//*********************************************
     public void run() {
         Thread thisTread = Thread.currentThread();
         while (t == thisTread) {
             current++;
             if (current >= totalpic) {
                 current = 0;
             }
             a1.play();
             m += 10;
             d -= 10;
             if (d == 0) {
                 d = 300;
             }
             if (m == 600) {
                 m = 0;
             }
             try {
                 t.sleep(pause);
             } catch (InterruptedException ex) {
             }
             repaint();
             if (c == m && d == n) {
                 picture[i] = null;
             }
             //  repaint();
             try {
                 t.sleep(50);
             } catch (InterruptedException ex) {
             }
             repaint();
         }
     }
//*************************************************
     /*   
        public asl() {
            try {
                jbInit();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        private void jbInit() throws Exception {
            this.addKeyListener(new asl_this_keyAdapter(this));
        }
        void this_keyPressed(KeyEvent e) {
            if (e.getKeyCode() == e.VK_RIGHT) {
                a += 10;
              //  b += 10;
                c += 10;
              //  d += 10;
                p += 10;
             //   q += 10;
            }
            if (e.getKeyCode() == e.VK_SPACE) {
                while(bb==0){
                    bb -= 10;
                }
            }
            if (e.getKeyCode() == e.VK_LEFT) {
             //   while (a == 2) {
                    a -= 10;
                    //   b-=10;
                    c-=10;
                    //   d-=10;
                    //   q-=10;
                    p -= 10;
              //  }
            }
            repaint();
        }
     }
     class asl_this_keyAdapter extends java.awt.event.KeyAdapter {
        asl adaptee;
        asl_this_keyAdapter(asl adaptee) {
            this.adaptee = adaptee;
        }
        public void keyPressed(KeyEvent e) {
            adaptee.this_keyPressed(e);
        }
}     //**********************************************
      public void update(Graphics screen) {
          paint(screen);
      }
}


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/vorbis-dev/attachments/20050814/a3fe430a/attachment.htm


More information about the Vorbis-dev mailing list