亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产欧美日韩精品a在线观看| 麻豆成人在线观看| 亚洲亚洲精品在线观看| 一区二区三区在线视频播放| 亚洲一区在线观看免费| 首页国产欧美日韩丝袜| av中文一区二区三区| 欧美午夜片在线看| 国产欧美一区二区在线| 亚洲午夜影视影院在线观看| 久久国内精品视频| 91在线观看视频| 欧美一区二区三区啪啪| 国产精品全国免费观看高清| 日日摸夜夜添夜夜添精品视频| 国产自产v一区二区三区c| 色素色在线综合| 久久久久久久久久久久久久久99| 亚洲精品中文在线| 国产精品一区二区久久不卡| 欧美视频你懂的| 国产精品国产三级国产| 国产传媒日韩欧美成人| 久久这里只有精品6| 另类小说色综合网站| 日韩精品影音先锋| 久久国产福利国产秒拍| 精品久久一二三区| 欧美综合在线视频| 欧美精品一区二区久久婷婷| 亚洲h动漫在线| 欧美精品国产精品| 日本在线播放一区二区三区| 欧美日韩国产区一| 久久99在线观看| 久久精品免视看| 成人性色生活片| 亚洲综合一区二区| 日韩欧美国产小视频| 蜜臀久久99精品久久久久宅男| 91麻豆精品国产91久久久久| 久久成人精品无人区| 国产丝袜在线精品| 欧美亚洲禁片免费| 久久国产福利国产秒拍| 国产精品免费网站在线观看| 欧美色综合影院| 成人免费视频网站在线观看| 艳妇臀荡乳欲伦亚洲一区| 26uuuu精品一区二区| 91行情网站电视在线观看高清版| 蜜桃精品视频在线观看| 亚洲啪啪综合av一区二区三区| 久久蜜桃av一区二区天堂| 国产91富婆露脸刺激对白| 欧美一区二区在线播放| 蜜臀91精品一区二区三区| 欧美激情一二三区| 久久久久88色偷偷免费 | 99视频一区二区| 国内精品自线一区二区三区视频| 亚洲国产精品欧美一二99| 亚洲欧美综合色| 国产欧美精品国产国产专区| 精品久久久久香蕉网| 日韩美一区二区三区| 色综合网站在线| 色综合 综合色| 欧美亚洲综合网| 欧美日精品一区视频| 日本道色综合久久| 成人av电影在线观看| 99在线精品一区二区三区| 国产精品一区免费在线观看| 国内精品不卡在线| 丁香另类激情小说| 欧美在线视频全部完| 91精品国产一区二区三区香蕉| 91麻豆精品国产综合久久久久久| 日韩一区二区三免费高清| 精品国产免费人成在线观看| 国产欧美精品区一区二区三区| 亚洲欧洲一区二区三区| 午夜伊人狠狠久久| 久久99精品久久久久久| 99久久婷婷国产综合精品电影 | 7777精品伊人久久久大香线蕉| 91精品欧美福利在线观看| 国产精品午夜久久| 免费成人美女在线观看.| 91麻豆6部合集magnet| 国产丝袜欧美中文另类| 日日欢夜夜爽一区| 91激情在线视频| 国产精品天干天干在观线| 偷拍一区二区三区| 色噜噜狠狠色综合中国| 国产亚洲人成网站| 免费xxxx性欧美18vr| 欧美日韩午夜在线| 亚洲精品福利视频网站| youjizz国产精品| 国产精品久久久久久久久搜平片| 麻豆专区一区二区三区四区五区| 欧美情侣在线播放| 日韩精品福利网| 日韩一区二区三| 国产制服丝袜一区| 欧美国产视频在线| 色哟哟一区二区三区| 亚洲国产色一区| 欧美一区二区在线播放| 国产一区亚洲一区| 国产精品日韩成人| 欧美色图激情小说| 美女一区二区在线观看| 久久综合九色综合97婷婷| 顶级嫩模精品视频在线看| 亚洲手机成人高清视频| 欧美精品乱人伦久久久久久| 另类小说视频一区二区| 中文一区二区完整视频在线观看| 色哟哟亚洲精品| 韩国女主播一区| 午夜一区二区三区视频| 久久久久国产成人精品亚洲午夜| 色综合久久六月婷婷中文字幕| 日韩精品一区第一页| 亚洲欧美偷拍卡通变态| 久久久精品黄色| 91精品国产高清一区二区三区蜜臀| 国产激情一区二区三区桃花岛亚洲| 一区二区三区在线看| 国产精品女主播av| 国产日韩精品一区二区三区在线| 欧美日韩国产a| 欧洲精品在线观看| 91农村精品一区二区在线| 成人性视频网站| 国产盗摄视频一区二区三区| 日本不卡高清视频| 无码av中文一区二区三区桃花岛| 亚洲一区影音先锋| 亚洲午夜在线视频| 五月婷婷另类国产| 亚洲一区二区三区自拍| 午夜久久久久久电影| 日韩电影一区二区三区四区| 午夜伦欧美伦电影理论片| 日韩不卡免费视频| 久久99精品视频| 99免费精品在线观看| 在线观看免费亚洲| 日韩精品一区二| 国产三级欧美三级日产三级99| 中文字幕在线不卡视频| 亚洲成人综合在线| 精品制服美女久久| 99久久精品免费看国产免费软件| 色伊人久久综合中文字幕| 欧美一级片在线观看| 国产精品久久久爽爽爽麻豆色哟哟| 亚洲精品日韩一| 狠狠色狠狠色综合日日91app| 99久久免费精品| 中文字幕乱码久久午夜不卡| 日韩在线观看一区二区| 一本大道av一区二区在线播放| 欧美成人激情免费网| 亚洲午夜精品一区二区三区他趣| 国产a精品视频| 日韩亚洲欧美高清| 日本一不卡视频| 欧美日韩午夜影院| 一区二区三区日韩欧美精品| 成人av在线一区二区三区| 欧美不卡一区二区三区四区| 亚洲一区二区三区美女| 色综合欧美在线视频区| 中文字幕成人网| 成人av在线资源网| 久久久精品免费观看| 国产盗摄视频一区二区三区| 久久久精品人体av艺术| 国产经典欧美精品| 亚洲同性同志一二三专区| 99精品视频一区二区三区| 亚洲精选一二三| 欧美日韩不卡一区| 极品少妇xxxx精品少妇偷拍| 精品久久久久久无| 99精品视频在线观看| 亚洲国产精品天堂| 久久精品一区四区| 在线视频国产一区| 精品一区二区三区在线观看| 久久―日本道色综合久久| 91激情在线视频| 国产精品资源站在线| 日本一二三不卡|