Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void run(){
- while(active == true){
- if (tpsDepart == 0) {
- if (duree>0){
- duree = duree-0.01 ;
- peindreFusee(g);
- }
- else if (duree == 0){
- active = false ;
- }
- }
- else if (tpsDepart >0){
- tpsDepart = tpsDepart - 0.01 ;
- }
- }
- try {
- Thread.sleep(10);//pause d'un centième seconde
- }
- catch(InterruptedException e) {
- System.out.println(e);
- }
- }
- //CONSTRUCTOR
- public TestFuseeAnimee() {
- this.setLocation(100, 100);
- this.setSize(1200,700);
- w = this.getSize().width ;
- h = this.getSize().height ;
- fus = new Fusee(1);
- fus.active = true ;
- fus.xf = w/2 ;
- fus.yf = h/2 ;
- fus.couleur = Color.red ;
- fus.forme = "etoile" ;
- fus.puissEtincelles = 2 ;
- fus.tpsDepart = 10 ;
- fus.duree = 20 ;
- addWindowListener(new EcouteurPourFermetureFenetre());
- }
- //METHOD
- public void paint(Graphics g){
- w = this.getSize().width ;
- h = this.getSize().height ;
- g.setColor(Color.black);
- g.fillRect(0, 0, w, h);
- fus.g = g;
- fus.anim.start();
- }
- //MAIN
- public static void main(String [] abs){
- TestFuseeAnimee fen = new TestFuseeAnimee();
- fen.setVisible(true) ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement