Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. public void run(){
  2. while(active == true){
  3. if (tpsDepart == 0) {
  4. if (duree>0){
  5. duree = duree-0.01 ;
  6. peindreFusee(g);
  7. }
  8. else if (duree == 0){
  9. active = false ;
  10. }
  11. }
  12. else if (tpsDepart >0){
  13. tpsDepart = tpsDepart - 0.01 ;
  14. }
  15. }
  16. try {
  17. Thread.sleep(10);//pause d'un centième seconde
  18. }
  19. catch(InterruptedException e) {
  20. System.out.println(e);
  21. }
  22. }
  23.  
  24. //CONSTRUCTOR
  25. public TestFuseeAnimee() {
  26. this.setLocation(100, 100);
  27. this.setSize(1200,700);
  28. w = this.getSize().width ;
  29. h = this.getSize().height ;
  30. fus = new Fusee(1);
  31. fus.active = true ;
  32. fus.xf = w/2 ;
  33. fus.yf = h/2 ;
  34. fus.couleur = Color.red ;
  35. fus.forme = "etoile" ;
  36. fus.puissEtincelles = 2 ;
  37. fus.tpsDepart = 10 ;
  38. fus.duree = 20 ;
  39. addWindowListener(new EcouteurPourFermetureFenetre());
  40. }
  41.  
  42. //METHOD
  43. public void paint(Graphics g){
  44. w = this.getSize().width ;
  45. h = this.getSize().height ;
  46. g.setColor(Color.black);
  47. g.fillRect(0, 0, w, h);
  48. fus.g = g;
  49. fus.anim.start();
  50. }
  51.  
  52.  
  53. //MAIN
  54. public static void main(String [] abs){
  55. TestFuseeAnimee fen = new TestFuseeAnimee();
  56. fen.setVisible(true) ;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement