亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ufo_attack.java

?? 一個打飛碟小游戲,界面漂亮
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
//這是一個用導彈攻擊UFO的小游戲//游戲開始有聲音提示,并且顯示提示信息//用戶通過點擊鼠標開始新游戲//UFO從游戲界面的頂部不斷地產生,并不規則的動作向下方移動//一旦移動到最下方,游戲即失敗//游戲界面的下部有導彈發射管,游戲者通過點擊鼠標發射導彈//要盡量做到百發百中,因為新導彈的裝配需要時間//如果一枚導彈沒有擊中,UFO就可能在這段裝配時間中移動到底部//導致游戲失敗。import java.awt.*;import java.applet.*;import java.util.*;public class UFO_Attack extends Applet implements Runnable {	Image buffer   = null ;	// 臨時圖象緩存	Image backdrop = null ; 	Image bgimg    = null ; 	Image ufostrip = null ;	// UFO Sequence	Image missile  = null ; // Misile Sequence	Image missile_explosion	               = null ; // 導彈爆炸	MediaTracker tracker = null ;	Graphics  buf_g = null ; // Buffer graphics object	Graphics  bkd_g = null ; // Backdrop graphics object	Dimension window_size = null;	Font font ;	Font font_s ;	        AudioClip explosion       = null ;        AudioClip newufo         = null ;        AudioClip missile_launch = null ;//每當在新的UFO產生,導彈發射或者導彈命中時候都會有不同的聲音提示	        Thread  game      = null ;	boolean game_over = true ;	int     mouse_x   = 100 ;        Rectangle paint_area = new Rectangle() ;        Rectangle new_area   = new Rectangle() ;	Launcher L  = null ;	Missile  M  = null ;	Vector   UV = new Vector() ;	Vector   EV = new Vector() ;	        int NU    = 1 ;	int score = 0 ;		Color gunColor;	Color mColor;	Color ufoColor;	Color scoreColor;	Color bgColor;		public void init() {	  System.out.println("UFO Attack: A game by Sergio Fanchiotti") ;	  tracker = new MediaTracker(this) ;          bgimg = getImage(this.getCodeBase(),"bgimg.gif") ;	  tracker.addImage(bgimg,0) ;          ufostrip = getImage(this.getCodeBase(),"ufostrip.gif") ;	  tracker.addImage(ufostrip,0) ;          missile  = getImage(this.getCodeBase(),"missile.gif") ;	  tracker.addImage(missile,0) ;          missile_explosion = getImage(this.getCodeBase(),"explosionstrip.gif") ;	  tracker.addImage(missile_explosion,0) ;	  font   = new Font("Helvetica", Font.BOLD, 24) ;	  font_s = new Font("Helvetica", Font.BOLD, 14) ;          // Define the colors to use	  bgColor    = new Color(0,0,128);	  gunColor   = new Color(0,88,0);	  mColor     = new Color(255,255,255);	  ufoColor   = new Color(255,0,0);	  scoreColor = new Color(0,0,255);	}	public void start() {	  // Change the cursor改變光標	  getFrame(this).setCursor(Frame.CROSSHAIR_CURSOR) ;	  window_size = size();	  buffer = null; 	  buffer = createImage(window_size.width, window_size.height);	  backdrop = null; 	  backdrop = createImage(window_size.width, window_size.height);	  buf_g = buffer.getGraphics();	  buf_g.setColor(bgColor);	  buf_g.fillRect(0, 0, window_size.width, window_size.height);         // Display initial message          set_say_font(font) ;          set_say_mode(CENTER) ;          set_say_style(SHADOW) ;	  say("UFO",10,80) ;	  say("ATTACK") ;          set_say_font(font_s) ;          set_say_style(NORMAL) ;	  say("") ;	  say("Click to start") ;	  say("a game") ;	  //repaint() ;	  Graphics g = getGraphics() ;          g.drawImage(buffer,0,0,this) ;          // Initialize the launcher	  mouse_x = window_size.width/2 ;           L = new Launcher(this) ;          L.set_color(gunColor) ;          // Initialize the missile          M = new Missile(this) ;          M.set_color(mColor) ;		          // Load the sound files now	  if (explosion == null) 	    explosion = getAudioClip(getCodeBase(),"explosion.au") ;	  if (newufo == null) 	    newufo    = getAudioClip(getCodeBase(),"sonar.au") ;	  if (missile_launch == null) 	    missile_launch = getAudioClip(getCodeBase(),"rocket.au") ;	  game_over = true ;//演奏聲音          newufo.play() ;         // Play sounds	  missile_launch.play() ;	  explosion.play() ;	}	public void stop() {	  // Stop the game if running 	  if (game != null) {	    game.stop() ;	    game = null ; // and eliminate the thread	  }	  // Reset the cursor	  getFrame(this).setCursor(Frame.DEFAULT_CURSOR) ;	}        // The main game thread	public void run() {	  // Define some local variables	  UFO  U ;	  Explosion  E ;	  long count = 0 ;          long ti    = 0 ;	   	  // Wait for the images to load	  Graphics g = getGraphics() ;	  g.setColor(Color.red) ;	  g.drawString("Starting Game...", 20,20) ;          while (tracker.checkAll(true) == false) { 	    if ((ti++ % 2) == 0) 	      g.setColor(Color.red) ;	    else 	      g.setColor(Color.green) ;	    g.drawString("*", 10,22) ;            try {Thread.sleep(50);} catch (InterruptedException e) { } ;	    if (ti > 1000) break ;	  }	            if (tracker.isErrorAny()) {	    showStatus("Error getting images") ;            return ;	  }	  showStatus("Loading completed") ;	  g.dispose() ;          // Paint the backdrop buffer	  buf_g = backdrop.getGraphics();          buf_g.drawImage(bgimg,0,0,window_size.width,window_size.height,this) ;          // Paint the screen	  buf_g = getGraphics();          buf_g.drawImage(backdrop,0,0,this) ;          // Paing the buffer	  buf_g = buffer.getGraphics();          buf_g.drawImage(bgimg,0,0,window_size.width,window_size.height,this) ;          // Display the buffer	  repaint() ;          // Display the initial setup	  display_score() ;	  L.draw() ;          showStatus("UFO ATTACK") ;	  // Action loop          for (;;) {	    ti = System.currentTimeMillis() ;	    //如果有足夠的空間容納更多的UFO,試著隨機性的增加一個	    if ((UV.size() < NU) && 	        (Math.random() > (UV.size() == 0 ? 0.90 : 0.98))) {              newufo.play() ;  // Play a bell 	      U = new UFO(this) ;               U.set_color(ufoColor) ;              // Set the UFO to fast descent if:	      if (score > 10 && Math.random() > 0.7) U.vy -= 1 ;              // Add UFO to the list	      UV.addElement(U) ;	    }	    //在背景上面繪制爆炸的圖象,并在結束的時候消除它	    for (int j=EV.size()-1; j>=0 ; --j) {	      E = (Explosion) EV.elementAt(j) ;	      if (E.active) {	        E.draw() ;              }              else {	        // System.out.println("Ending Explosion " + j) ;	        E.erase() ;		EV.removeElementAt(j) ;	      }	    }	  	    // Move the launcher and the missile	    L.move() ;	    if (M.active() == true) M.move() ;            // Move each UFO	    for (int i=0; i < UV.size(); ++i) {	      U = (UFO) UV.elementAt(i) ;	      U.move() ;	    }            // Check for collision between UFO and missile	    for (int i=(UV.size()-1); i >=0 ; --i) {	      U = (UFO) UV.elementAt(i) ;	      if (U.active() && M.active() && U.collision(M)) {		++score ;	        explosion.stop() ; 		display_score() ;	        explosion.play() ;                 // Increase the max # of UFOs every 10 destroyed		// till we reach a max of 5 attacking	        if ((NU < 5) && (score % 10) == 1)  ++NU ;                // Erase the missile and deactivate it	        M.active(false) ;		M.erase() ;                // Erase and deactivate the UFO hit		U.active(false) ;		U.erase() ;		// Display an explosion		E = new Explosion(this,U.px,U.py) ;	        // System.out.println("Adding Explosion") ;		EV.addElement(E) ;	      }              // Draw the UFO or eliminate it from the list	      if (U.active()) 	        U.draw() ;              else 	        UV.removeElementAt(i) ;              // If a UFO reaches the floor then you've lost              if ((U.py - U.h/2) <=0) {	        game_over = true ;		display_game_over() ;		return ;	      }	    }            // If the launcher moves... redraw	    if (L.has_moved() || ((M.py-M.h) < (L.py+L.h)) || (! M.active()) )	      L.draw() ;            // If active redraw the missile	    if (M.active() == true) M.draw() ;            // Make the loop last 20ms in case the CPU is too fast...            ti = System.currentTimeMillis() - ti ;	    ti = 20 - ti ; 	    ti = ti > 0 ?  10 + ti : 10 ; // At least sleep por 10ms            Thread.yield() ; // Let the GC work?            try {Thread.sleep(ti);} catch (InterruptedException e) { } ;            // Repaint every 100 cycles... just in case	    if ((count = ++count % 500) == 0) {	      repaint() ;              // g.drawImage(buffer,0,0,this) ;	    }	  }	}//顯示戰績//	public void display_score() {          Graphics bkd_g = backdrop.getGraphics();          bkd_g.clipRect(window_size.width/2, 0, window_size.width/2, 40);          bkd_g.drawImage(bgimg,0,0,window_size.width,window_size.height,this) ;          bkd_g.setColor(Color.red) ;          bkd_g.setFont(font) ;	  String aux = score > 9 ? "" : "0" ;          bkd_g.drawString(aux+score, window_size.width - 60,30) ;          bkd_g.dispose() ;          Graphics bg = buffer.getGraphics() ;          bg.clipRect(0, 0, window_size.width, 40);          bg.drawImage(backdrop,0,0,this) ;          bg.dispose() ;          // bg = null ;          Graphics g = getGraphics() ;          g.clipRect(0, 0, window_size.width, 40);          g.drawImage(buffer,0,0,this) ;          g.dispose() ;          // g = null ;	}	public void display_game_over() {          set_say_font(font) ;          set_say_mode(CENTER) ;          set_say_style(SHADOW) ;	  set_say_pos(10,80) ;	  say("GAME OVER") ;          set_say_font(font_s) ;          set_say_style(NORMAL) ;	  say("(click to start)") ;	  repaint() ;          try {Thread.sleep(500);} catch (InterruptedException e) { } ;	}	public boolean mouseMove(Event e, int x, int y) {	  // showStatus("mouse at: (" + x + ", " + y + ")");	  mouse_x = x ;	  return true;	}        // Capture the mouse clicks	public boolean mouseDown(Event e, int x, int y) {	  if (game_over) {	    game_over = false ;	    if (game != null) {	      game.stop() ;	      game = null ;	    }	    NU    = 1 ;	    score = 0 ;	    M.active(false) ;	    UV.removeAllElements() ;	    EV.removeAllElements() ;	    game  = new Thread(this) ;	    game.setPriority(Thread.MIN_PRIORITY) ;	    game.start() ;	    buf_g.dispose() ;	    return true ;	  }	  if (M != null && ! M.active()) {	    missile_launch.stop() ;	    missile_launch.play() ;	    M.set_pos(L.px,L.py) ;	    M.active(true) ;	  }	  return true;	}		// The paint methos just draws the buffer	public void paint(Graphics g) { 	  if (buffer != null) g.drawImage(buffer, 0, 0, this);	}        // Makes an animation smoother	public void update(Graphics g) { 	  paint(g) ; 	}        // Get the Frame of this applet        public Frame getFrame(Component c) {          while( c != null && !(c instanceof java.awt.Frame) )                c = c.getParent();          return (Frame) c;        }        // Text Display Constants        public static final int CENTER = 1 ;  // Modes: Centered        public static final int LEFT   = 2 ;  //        Left Justified        public static final int RIGHT  = 3 ;  //        Right Justified        public static final int FREE   = 0 ;  //        At x,y        public static final int NORMAL = 0 ;  // Styles: Normal        public static final int SHADOW = 1 ;  //         Shadowed         // Text Display Variables        private int  say_pos_y   =  0 ;        private int  say_pos_x   =  0 ;        private int  say_mode    = -1 ;        private int  say_style   = -1 ;        private int  say_margin  = 10 ;        private Font say_font    = null ;        // Text Print Methods	public void say(String s, int x, int y) {	  set_say_pos(x, y) ;	  say(s) ;	}	public void say(String s) {	  FontMetrics fm = getFontMetrics(say_font) ;          // Compute the x position	  switch(say_mode) {	    case CENTER:	      say_pos_x = (window_size.width - fm.stringWidth(s))/2 ;	      break ;	    case RIGHT:	      say_pos_x = window_size.width - fm.stringWidth(s) - say_margin ;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久综合网站| 91成人在线精品| 欧美精品一区二区三区在线播放| 婷婷激情综合网| 日韩欧美在线1卡| 国产真实乱偷精品视频免| 久久噜噜亚洲综合| 国产91精品一区二区麻豆网站| 国产日韩三级在线| 91丝袜美腿高跟国产极品老师| 亚洲三级在线免费观看| 欧美日韩电影在线| 紧缚奴在线一区二区三区| 国产欧美一区二区三区网站| 色偷偷成人一区二区三区91| 亚洲综合视频网| 日韩欧美国产1| 成人在线一区二区三区| 亚洲在线中文字幕| 精品福利在线导航| www.亚洲在线| 天堂久久一区二区三区| 国产性做久久久久久| 91日韩精品一区| 蜜臀a∨国产成人精品| 久久久久久久久蜜桃| 色域天天综合网| 伦理电影国产精品| 国产精品看片你懂得| 欧美乱妇15p| 成人黄色电影在线 | 欧美一区二区免费视频| 国产乱码精品一区二区三| 亚洲靠逼com| 精品福利一二区| 在线亚洲+欧美+日本专区| 极品少妇xxxx精品少妇偷拍| 亚洲欧美另类在线| 精品国产电影一区二区| 欧美午夜免费电影| 高清视频一区二区| 免费在线观看不卡| 一级精品视频在线观看宜春院| 日韩网站在线看片你懂的| 99久久精品国产观看| 美国精品在线观看| 亚洲激情五月婷婷| 欧美国产视频在线| 欧美精品一区二区三区视频| 欧美亚洲综合另类| jvid福利写真一区二区三区| 精品一区免费av| 午夜久久久影院| 亚洲免费观看高清在线观看| 国产日韩一级二级三级| 欧美成人福利视频| 在线播放欧美女士性生活| 日本久久一区二区| av不卡免费在线观看| 国产白丝网站精品污在线入口| 欧美aaa在线| 天堂成人国产精品一区| 一区二区免费看| 亚洲三级理论片| 国产精品乱码一区二三区小蝌蚪| 久久精品视频在线看| 日韩欧美在线不卡| 日韩一区二区免费在线观看| 欧美日韩在线播放一区| 欧美综合一区二区三区| 91免费观看在线| 色综合久久精品| 91香蕉视频污在线| 91欧美一区二区| 一本一道久久a久久精品综合蜜臀| 国产乱码精品一区二区三区五月婷| 老司机一区二区| 久久66热偷产精品| 韩日欧美一区二区三区| 国内外成人在线| 国产精品主播直播| 成人一二三区视频| 99久久99久久免费精品蜜臀| 成人免费视频app| av一区二区三区黑人| 99精品热视频| 欧美午夜在线一二页| 中文字幕一区二区三区在线播放 | 青青草91视频| 麻豆视频观看网址久久| 精品一区二区三区免费视频| 激情久久五月天| 成人亚洲精品久久久久软件| k8久久久一区二区三区| 色狠狠综合天天综合综合| 欧美军同video69gay| 91精品国产免费| 久久无码av三级| 亚洲欧洲性图库| 亚洲成人免费观看| 麻豆精品视频在线观看视频| 国产精品资源网站| 91天堂素人约啪| 欧美久久久久中文字幕| 久久天堂av综合合色蜜桃网| 亚洲欧洲日韩女同| 亚洲一区在线观看免费| 久久精品国产在热久久| 福利一区福利二区| 欧美亚洲国产一区二区三区| 欧美哺乳videos| 亚洲欧洲精品天堂一级| 天天亚洲美女在线视频| 国产精品一级片在线观看| 91丨国产丨九色丨pron| 日韩一区二区免费在线观看| 国产精品天干天干在线综合| 亚洲成人免费av| 顶级嫩模精品视频在线看| 欧美伊人久久大香线蕉综合69| 日韩美女主播在线视频一区二区三区 | 精品日韩av一区二区| 中文字幕在线不卡| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产 欧美在线| 欧美日韩aaaaa| 国产精品乱人伦一区二区| 日产欧产美韩系列久久99| 不卡一区中文字幕| 日韩一区二区三区四区| 亚洲精品国产视频| 国产一区日韩二区欧美三区| 欧美天堂亚洲电影院在线播放 | 国产亚洲午夜高清国产拍精品| 一区二区三区日韩在线观看| 国产一区二区三区四区五区美女| 欧美综合一区二区| 国产精品久久久一本精品| 久99久精品视频免费观看| 欧美在线免费播放| 国产精品美日韩| 精品午夜久久福利影院| 欧美欧美欧美欧美首页| 亚洲视频一二三区| 粉嫩在线一区二区三区视频| 日韩欧美亚洲一区二区| 亚洲无人区一区| 欧美精品一区二区高清在线观看| 亚洲国产精品久久久久秋霞影院 | 日韩电影免费在线观看网站| 色综合久久中文综合久久97| 亚洲国产成人午夜在线一区| 久久99久久99| 日韩欧美综合一区| 蜜桃视频第一区免费观看| 精品视频资源站| 亚洲一区二区成人在线观看| 色综合天天综合| 1024亚洲合集| 99re这里只有精品视频首页| 国产精品情趣视频| 国产91露脸合集magnet| 国产欧美精品一区| 国产成人超碰人人澡人人澡| 精品久久久久久久久久久院品网| 全国精品久久少妇| 日韩欧美国产三级| 久久99热狠狠色一区二区| 日韩精品一区在线| 狠狠色2019综合网| 久久久久国产精品麻豆ai换脸| 黄页视频在线91| 久久综合狠狠综合久久综合88| 国产自产v一区二区三区c| 337p粉嫩大胆噜噜噜噜噜91av| 国内精品嫩模私拍在线| 久久精品亚洲一区二区三区浴池| 国产精品一区三区| 国产精品久久久久婷婷二区次| 成人av在线观| 亚洲免费av高清| 欧美色图一区二区三区| 日韩精品午夜视频| 精品国产乱码久久久久久1区2区| 国产九九视频一区二区三区| 国产精品入口麻豆原神| 99久久精品国产导航| 午夜久久久久久| 精品日韩99亚洲| 成人精品亚洲人成在线| 亚洲免费在线观看视频| 欧美性xxxxxx少妇| 美女诱惑一区二区| 国产亚洲精品福利| 色哟哟一区二区| 美国十次综合导航| 国产视频一区在线播放| 色呦呦日韩精品| 免费视频一区二区| 国产精品美女久久久久av爽李琼 |