[Java] 幸运-幸运6666 →→→→→进入此内容的聊天室

来自 , 2020-08-11, 写在 Java, 查看 194 次.
URL http://www.code666.cn/view/be3e9d3f
  1. 幸运
  2.  @Override
  3.             public void mouseExited(MouseEvent e) {
  4.                 if(state==RUNNING) {
  5.                     state=PAUSE;
  6.                     }
  7.             }
  8.  
  9.             @Override
  10.             public void mouseEntered(MouseEvent e) {
  11.                 if(state==PAUSE) {
  12.                     state=RUNNING;
  13.                     }
  14.             }
  15.              
  16.              
  17.         };
  18.         this.addMouseMotionListener(l);
  19.         this.addMouseListener(l);
  20.         Timer timer=new Timer();
  21.         timer.schedule(new TimerTask() {
  22.             private int runTimes=0;
  23.             @Override
  24.             public void run() {
  25.                 if(state==RUNNING) {
  26.                     runTimes++;
  27.                     if(runTimes%40==0) {
  28.                         nextOne();
  29.                     }
  30.                     for(int i=0;i<flyers.length;i++) {
  31.                         flyers[i].step();
  32.                     }
  33.                     if(runTimes%15==0) {
  34.                         shoot();
  35.                     }
  36.                     for(int i=0;i<bullets.length;i++) {
  37.                         bullets[i].step();
  38.                     }
  39.                     hero.step();
  40.                     bang();
  41.                     hit();
  42.                     outOfBounds();
  43.                 }
  44.                 repaint();
  45.             }
  46.              
  47.         }, 5,5);
  48.     }
  49.  
  50.     @Override
  51.     public void paint(Graphics g) {
  52.          
  53.         g.drawImage(background,0,0,null);//super.paint(arg0);
  54.          
  55.         paintHero(g);
  56.          
  57.         paintFlyers(g);
  58.          
  59.         paintBullets(g);
  60.          
  61.         paintScore_Life(g);
  62.          
  63.         if(state==START) {
  64.             g.drawImage(start, 0, 0, null);
  65.         }else if(state==PAUSE){
  66.             g.drawImage(pause, 0, 0, null);
  67.         }else if(state==GAME_OVER) {
  68.             g.drawImage(gameover, 0, 0, null);
  69.         }
  70.     }
  71.     public void paintHero(Graphics g) {
  72.         g.drawImage(hero.image,hero.x,hero.y,null);
  73.     }
  74.     public void paintFlyers(Graphics g) {
  75.  

回复 "幸运-幸运6666"

这儿你可以回复上面这条便签

captcha