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

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

?? mazecanvas.java

?? j2me下的方塊游戲 直接放到wtk下即可運行
?? JAVA
字號:
package Maze;import javax.microedition.lcdui.*;/** * This class is the display of the game. *  * @author Carol Hamer */public class MazeCanvas extends javax.microedition.lcdui.Canvas {  //---------------------------------------------------------  //   static fields  /**   * color constant   */  public static final int BLACK = 0;  /**   * color constant   */  public static final int WHITE = 0xffffff;  //---------------------------------------------------------  //   instance fields  /**   * a handle to the display.   */  private Display myDisplay;  /**   * The data object that describes the maze configuration.   */  private Grid myGrid;  /**   * Whether or not the currently displayed maze has    * been completed.   */  private boolean myGameOver = false;  /**   * maze dimension: the width of the maze walls.   */  private int mySquareSize;  /**   * maze dimension: the maximum width possible for the maze walls.   */  private int myMaxSquareSize;  /**   * maze dimension: the minimum width possible for the maze walls.   */  private int myMinSquareSize;  /**   * top corner of the display: x-coordiate   */  private int myStartX = 0;  /**   * top corner of the display: y-coordinate   */  private int myStartY = 0;  /**   * how many rows the display is divided into.   */  private int myGridHeight;  /**   * how many columns the display is divided into.   */  private int myGridWidth;  /**   * the maximum number columns the display can be divided into.   */  private int myMaxGridWidth;  /**   * the minimum number columns the display can be divided into.   */  private int myMinGridWidth;  /**   * previous location of the player in the maze: x-coordiate   * (in terms of the coordinates of the maze grid, NOT in terms    * of the coordinate system of the Canvas.)   */  private int myOldX = 1;  /**   * previous location of the player in the maze: y-coordinate   * (in terms of the coordinates of the maze grid, NOT in terms    * of the coordinate system of the Canvas.)   */  private int myOldY = 1;  /**   * current location of the player in the maze: x-coordiate   * (in terms of the coordinates of the maze grid, NOT in terms    * of the coordinate system of the Canvas.)   */  private int myPlayerX = 1;  /**   * current location of the player in the maze: y-coordinate   * (in terms of the coordinates of the maze grid, NOT in terms    * of the coordinate system of the Canvas.)   */  private int myPlayerY = 1;  //-----------------------------------------------------  //    gets / sets  /**   * Changes the width of the maze walls and calculates how    * this change affects the number of rows and columns    * the maze can have.   * @return the number of columns now that the the    *         width of the columns has been updated.   */  int setColWidth(int colWidth) {    if(colWidth < 2) {      mySquareSize = 2;    } else {      mySquareSize = colWidth;    }    myGridWidth = getWidth() / mySquareSize;    if(myGridWidth % 2 == 0) {      myGridWidth -= 1;    }    myGridHeight = getHeight() / mySquareSize;    if(myGridHeight % 2 == 0) {      myGridHeight -= 1;    }    myGrid = null;    return(myGridWidth);  }  /**   * @return the minimum width possible for the maze walls.   */  int getMinColWidth() {    return(myMinSquareSize);  }  /**   * @return the maximum width possible for the maze walls.   */  int getMaxColWidth() {    return(myMaxSquareSize);  }  /**   * @return the maximum number of columns the display can be divided into.   */  int getMaxNumCols() {    return(myMaxGridWidth);  }  /**   * @return the width of the maze walls.   */  int getColWidth() {    return(mySquareSize);  }  /**   * @return the number of maze columns the display is divided into.   */  int getNumCols() {    return(myGridWidth);  }  //-----------------------------------------------------  //    initialization and game state changes  /**   * Constructor performs size calculations.   * @throws Exception if the display size is too    *         small to make a maze.   */  public MazeCanvas(Display d) throws Exception {    myDisplay = d;    // a few calculations to make the right maze     // for the current display.    int width = getWidth();    int height = getHeight();    // tests indicate that 5 is a good default square size,     // but the user can change it...    mySquareSize = 5;    myMinSquareSize = 3;    myMaxGridWidth = width / myMinSquareSize;    if(myMaxGridWidth % 2 == 0) {      myMaxGridWidth -= 1;    }    myGridWidth = width / mySquareSize;    if(myGridWidth % 2 == 0) {      myGridWidth -= 1;    }    myGridHeight = height / mySquareSize;    if(myGridHeight % 2 == 0) {      myGridHeight -= 1;    }    myMinGridWidth = 15;    myMaxSquareSize = width / myMinGridWidth;    if(myMaxSquareSize > height / myMinGridWidth) {      myMaxSquareSize = height / myMinGridWidth;    }    // if the display is too small to make a reasonable maze,     // then we throw an Exception    if(myMaxSquareSize < mySquareSize) {      throw(new Exception("Display too small"));    }  }  /**   * This is called as soon as the application begins.   */  void start() {    myDisplay.setCurrent(this);    repaint();  }  /**   * discard the current maze and draw a new one.   */  void newMaze() {    myGameOver = false;    // throw away the current maze.    myGrid = null;    // set the player back to the beginning of the maze.    myPlayerX = 1;    myPlayerY = 1;    myOldX = 1;    myOldY = 1;    myDisplay.setCurrent(this);    // paint the new maze    repaint();  }  //-------------------------------------------------------  //  graphics methods  /**   * Create and display a maze if necessary, otherwise just    * move the player.  Since the motion in this game is    * very simple, it is not necessary to repaint the whole    * maze each time, just the player + erase the square    * that the player just left..   */  protected void paint(Graphics g) {    // If there is no current maze, create one and draw it.    if(myGrid == null) {      int width = getWidth();      int height = getHeight();      // create the underlying data of the maze.      myGrid = new Grid(myGridWidth, myGridHeight);      // draw the maze:      // loop through the grid data and color each square the       // right color      for(int i = 0; i < myGridWidth; i++) {	for(int j = 0; j < myGridHeight; j++) {	  if(myGrid.mySquares[i][j] == 0) {	    g.setColor(BLACK);	  } else {	    g.setColor(WHITE);	  }	  // fill the square with the appropriate color	  g.fillRect(myStartX + (i*mySquareSize), 		     myStartY + (j*mySquareSize), 		     mySquareSize, mySquareSize);	}      }      // fill the extra space outside of the maze      g.setColor(BLACK);      g.fillRect(myStartX + ((myGridWidth-1) * mySquareSize), 		 myStartY, width, height);      // erase the exit path:       g.setColor(WHITE);      g.fillRect(myStartX + ((myGridWidth-1) * mySquareSize), 		 myStartY + ((myGridHeight-2) * mySquareSize), width, height);      // fill the extra space outside of the maze      g.setColor(BLACK);      g.fillRect(myStartX, 		 myStartY + ((myGridHeight-1) * mySquareSize), width, height);    }    // draw the player (red):     g.setColor(255, 0, 0);    g.fillRoundRect(myStartX + (mySquareSize)*myPlayerX, 		    myStartY + (mySquareSize)*myPlayerY, 		    mySquareSize, mySquareSize, 		    mySquareSize, mySquareSize);    // erase the previous location    if((myOldX != myPlayerX) || (myOldY != myPlayerY)) {      g.setColor(WHITE);      g.fillRect(myStartX + (mySquareSize)*myOldX, 		    myStartY + (mySquareSize)*myOldY, 		    mySquareSize, mySquareSize);    }    // if the player has reached the end of the maze,     // we display the end message.    if(myGameOver) {      // perform some calculations to place the text correctly:      int width = getWidth();      int height = getHeight();      Font font = g.getFont();      int fontHeight = font.getHeight();      int fontWidth = font.stringWidth("Maze Completed");      g.setColor(WHITE);      g.fillRect((width - fontWidth)/2, (height - fontHeight)/2,		       fontWidth + 2, fontHeight);      // write in red      g.setColor(255, 0, 0);      g.setFont(font);      g.drawString("Maze Completed", (width - fontWidth)/2, 		   (height - fontHeight)/2,			 Graphics.TOP|Graphics.LEFT);    }  }  /**   * Move the player.   */  public void keyPressed(int keyCode) {      if(! myGameOver) {      int action = getGameAction(keyCode);         switch (action) {      case LEFT:	if((myGrid.mySquares[myPlayerX-1][myPlayerY] == 1) && 	   (myPlayerX != 1)) {	  myOldX = myPlayerX;	  myOldY = myPlayerY;	  myPlayerX -= 2;	  repaint();	}	break;      case RIGHT:	if(myGrid.mySquares[myPlayerX+1][myPlayerY] == 1) {	  myOldX = myPlayerX;	  myOldY = myPlayerY;	  myPlayerX += 2;	  repaint();	} else if((myPlayerX == myGrid.mySquares.length - 2) && 		  (myPlayerY == myGrid.mySquares[0].length - 2)) {	  myOldX = myPlayerX;	  myOldY = myPlayerY;	  myPlayerX += 2;	  myGameOver = true;	  repaint();	}	break;      case UP:	if(myGrid.mySquares[myPlayerX][myPlayerY-1] == 1) {	  myOldX = myPlayerX;	  myOldY = myPlayerY;	  myPlayerY -= 2;	  repaint();	}	break;      case DOWN:	if(myGrid.mySquares[myPlayerX][myPlayerY+1] == 1) {	  myOldX = myPlayerX;	  myOldY = myPlayerY;	  myPlayerY += 2;	  repaint();	}	break;      }    }  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲激情五月婷婷| 国产福利不卡视频| 日韩av电影免费观看高清完整版| 午夜影视日本亚洲欧洲精品| 亚洲成a人片在线观看中文| 日韩国产高清在线| 国产成人免费视频| 欧美日韩亚洲综合一区| 2021中文字幕一区亚洲| 亚洲靠逼com| 激情五月激情综合网| 91浏览器在线视频| 精品国产免费人成在线观看| 亚洲一区二区在线免费看| 精品在线你懂的| 一本色道亚洲精品aⅴ| 欧美一区二区成人| 亚洲女性喷水在线观看一区| 麻豆免费精品视频| 91一区二区三区在线观看| 日韩精品在线一区| 亚洲精品视频一区二区| 国产一区二区三区在线观看免费| 色综合视频在线观看| 精品剧情在线观看| 水野朝阳av一区二区三区| 成人av在线网| 亚洲精品一区在线观看| 亚洲福利一二三区| 91亚洲精华国产精华精华液| 久久网站最新地址| 石原莉奈在线亚洲三区| 色哟哟在线观看一区二区三区| 久久新电视剧免费观看| 天堂一区二区在线| 欧美伊人久久久久久久久影院| 中文字幕av一区二区三区| 男人的j进女人的j一区| 7777精品伊人久久久大香线蕉最新版| 日韩一区中文字幕| 成人综合婷婷国产精品久久蜜臀| 日韩一级在线观看| 日韩精品电影在线观看| 欧美色综合网站| 一区二区三区不卡视频在线观看| 国产99久久久国产精品| 久久综合狠狠综合| 精品亚洲欧美一区| 精品久久久久久亚洲综合网 | 国产精品毛片高清在线完整版| 美女脱光内衣内裤视频久久影院| 欧美日韩精品一区二区在线播放| 亚洲欧美日韩成人高清在线一区| 91麻豆高清视频| 亚洲精选视频在线| 欧美三级午夜理伦三级中视频| 一区二区三区在线免费观看| 欧美少妇bbb| 日日摸夜夜添夜夜添精品视频| 欧美日韩1234| 日韩激情一二三区| 欧美一区二区三区喷汁尤物| 久久福利视频一区二区| 337p粉嫩大胆色噜噜噜噜亚洲| 国产又黄又大久久| 中文字幕 久热精品 视频在线| 成人aa视频在线观看| 国产精品不卡一区二区三区| 99r国产精品| 亚洲午夜精品网| 91精品在线一区二区| 另类欧美日韩国产在线| 久久精品在线免费观看| 99久久精品国产麻豆演员表| 一区二区三区欧美视频| 884aa四虎影成人精品一区| 国产中文字幕精品| 国产精品进线69影院| 日本精品一区二区三区高清 | 麻豆久久一区二区| 日韩欧美高清在线| 国产一区在线不卡| 国产欧美一区二区三区鸳鸯浴 | 99国产精品久久久久久久久久久| 国产精品视频一区二区三区不卡| 色系网站成人免费| 青青草91视频| 亚洲日本护士毛茸茸| 91精品国产色综合久久不卡蜜臀| 国产九九视频一区二区三区| 亚洲精品国产无套在线观| 日韩欧美自拍偷拍| 色偷偷久久一区二区三区| 麻豆91精品视频| 亚洲美女视频在线| 久久视频一区二区| 欧美三级电影网站| 国产九色sp调教91| 午夜影院久久久| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 看片网站欧美日韩| 亚洲毛片av在线| 2023国产精华国产精品| 欧美日韩不卡视频| 99久久精品99国产精品| 国产一区二区三区av电影| 亚洲午夜影视影院在线观看| 久久久www免费人成精品| 欧美剧情片在线观看| 99久久精品免费| 国产成人h网站| 毛片av中文字幕一区二区| 亚洲福利国产精品| 中文字幕五月欧美| 久久久久国产精品免费免费搜索| 欧美剧情电影在线观看完整版免费励志电影 | 国产a级毛片一区| 美国十次综合导航| 视频一区二区中文字幕| 亚洲欧美偷拍卡通变态| 国产精品乱人伦一区二区| 精品精品欲导航| 91麻豆精品国产91久久久更新时间| 不卡的av在线播放| 国产乱人伦偷精品视频免下载| 蜜臀av一区二区在线免费观看| 亚洲精品成a人| 久久久久亚洲蜜桃| 欧美精品一区二区三| 日韩欧美一级二级| 欧美一区二区在线看| 日韩一区二区免费高清| 欧美日韩国产系列| 91精品国产综合久久国产大片| 欧美偷拍一区二区| 欧美优质美女网站| 欧美三级中文字| 这里只有精品99re| 精品日韩av一区二区| 日韩精品中午字幕| 久久久精品中文字幕麻豆发布| 精品日韩在线观看| 精品国产3级a| 国产情人综合久久777777| 久久久不卡网国产精品一区| 国产午夜精品美女毛片视频| 国产夜色精品一区二区av| 亚洲国产成人一区二区三区| 国产亚洲美州欧州综合国| 中文字幕精品一区二区精品绿巨人| 国产精品国产馆在线真实露脸| 亚洲素人一区二区| 亚洲v日本v欧美v久久精品| 婷婷国产v国产偷v亚洲高清| 日本欧美一区二区| 九色|91porny| k8久久久一区二区三区| 91久久精品国产91性色tv| 91精品欧美福利在线观看| 久久久久亚洲蜜桃| 亚洲老妇xxxxxx| 看国产成人h片视频| 成人激情小说网站| 欧美午夜不卡在线观看免费| 制服丝袜亚洲播放| 国产精品免费免费| 亚洲电影在线免费观看| 麻豆freexxxx性91精品| eeuss鲁一区二区三区| 欧美疯狂性受xxxxx喷水图片| 日韩欧美123| 18涩涩午夜精品.www| 舔着乳尖日韩一区| 高清成人免费视频| 91精品国产一区二区三区| 国产人妖乱国产精品人妖| 一区二区三区久久久| 激情av综合网| 91国偷自产一区二区开放时间 | 国产一区欧美一区| 色哟哟一区二区在线观看| 精品国产三级电影在线观看| 伊人婷婷欧美激情| 国产又粗又猛又爽又黄91精品| 欧美亚洲一区三区| 国产精品伦一区二区三级视频| 日本在线不卡一区| 色综合久久88色综合天天6| 日韩欧美色电影| 亚洲另类中文字| 成人免费视频网站在线观看| 成人精品gif动图一区| 91精品久久久久久久久99蜜臂| 国产精品免费人成网站| 日韩av网站免费在线| 国产91精品一区二区麻豆亚洲| 国产美女娇喘av呻吟久久| 国产精品影视网| 久久影视一区二区| 裸体歌舞表演一区二区|