freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

j2me課程設(shè)計——手機俄羅斯方塊小游戲的開發(fā)-資料下載頁

2025-06-29 07:37本頁面
  

【正文】 , mainWidth, mainHeight)。 (BACKGROUD)。 (, , 16 * , 16 * )。 }}package Tetris。import .*。import .*。/** * pDescription:MIDlet /p * pCopyright: Copyright (c) 2012/p * @author: 張永義(634357642@) * @version */public class TetrisGame extends MIDlet{ TetrisCanvas ketris。 public TetrisGame(){ ketris = new TetrisCanvas(this)。 } public void startApp(){ (this).setCurrent(ketris)。 } public void pauseApp(){ } public void destroyApp(boolean unc){ }}package Tetris。import .*。import 。import 。import 。import 。import 。/** * 游戲地圖,地圖高16個小磚塊,寬16小磚塊,但是游戲容器高16,寬12(包括左右2堵墻) * 所以容器的內(nèi)直徑為10 */public class TetrisMap { //地圖數(shù)據(jù) protected int mapdata[][]。 protected boolean mapBlockExist[]。 //長度為16的boolean數(shù)組,如果mapBlockExist[i]=true,則第i+1行有磚塊 private int score。 //分數(shù) public static final Font SCOREFONT = (, , )。 public static Player player。 static { try { InputStream is = (/)。 player = (is, audio/xwav)。 } catch (IOException ioe) { ()。 } catch (MediaException me) { ()。 } } public TetrisMap() { mapdata = new int[16][12]。 mapBlockExist = new boolean[16]。 } public void init() { //清除計分 score = 0。 //先把全部元素清0 for (int i = 0。 i 16。 i++) { for (int j = 0。 j 12。 j++) { mapdata[i][j] = 0。 } mapBlockExist[i] = false。 } //設(shè)置2堵墻 for (int i = 0。 i 16。 i++) { mapdata[i][0] = 8。 mapdata[i][11] = 8。 } //設(shè)置容器底 for (int i = 0。 i 12。 i++) { mapdata[15][i] = 8。 } mapBlockExist[15] = true。 } /** * 獲取地圖某行某列的數(shù)據(jù) * @param x int 行號 * @param y int 列號 * @return int 地圖數(shù)據(jù),非0表示有磚塊 */ public int get(int x, int y) { int data = mapdata[y][x]。 return data。 } /* 設(shè)置地圖數(shù)據(jù) */ public void set(int x, int y, int val) { if (x = 0 amp。amp。 y = 0) { mapdata[y][x] = val。 mapBlockExist[y] = true。 } } /** * 該方法其實只負責(zé)非運動磚塊 */ public void paint(Graphics g) { //清屏 (g)。 for (int i = 0。 i 16。 i++) { for (int j = 0。 j 12。 j++) { if (mapdata[i][j] == 8) { ( + j * , + i * , g, 7)。 } } } } public boolean check(Graphics g, int row) { boolean deleteFlag = false。 //最多可以連消4行 int tmpRowNo。 if (row + 4 = 15) { tmpRowNo = 15。 } else { tmpRowNo = row + 4。 } for (int y = row。 y tmpRowNo。 y++) { boolean flag = true。 for (int x = 1。 x 11。 x++) { if (mapdata[y][x] == 0) { /* 空白區(qū) */ flag = false。 } } /* 需要消行 */ if (flag) { mapBlockExist[y] = false。 for (int x = 1。 x 11。 x++) { mapdata[y][x] = 0。 } deleteRow(g, y)。 deleteFlag = true。 //加分 score += 10。 paintScore(g)。 //發(fā)聲 try { if (player != null) { ()。 } } catch (MediaException me) { (sound not availible)。 } } } return deleteFlag。 } //刪除行,只是簡單的把該行置黑 protected void deleteRow(Graphics g, int y) { ()。 ( + , + y * , 10 * , )。 } /* 該方法在有消去行為后調(diào)用 */ public void repaintMap(Graphics g) { //從容啟底開始 for (int i = 14。 i 0。 i) { int tmp。 //有磚塊的行才移動 if (mapBlockExist[i]) { //只有下一行為空白行才進行移動 if (!mapBlockExist[i + 1]) { tmp = i + 1。 if (!mapBlockExist[i + 2]) { tmp = i + 2。 if (!mapBlockExist[i + 3]) { tmp = i + 3。 } } deleteRow(g, i)。 //行復(fù)制 for (int j = 1。 j 11。 j++) { mapdata[tmp][j] = mapdata[i][j]。 mapdata[i][j] = 0。 } mapBlockExist[i] = false。 mapBlockExist[tmp] = true。 drawBlock(g, tmp)。 } } } } public void drawBlock(Graphics g, int y) { for (int x = 1。 x 11。 x++) { if (mapdata[y][x] != 0) { ( + x * , + y * , g, mapdata[y][x] 1)。 } } } private void paintScore(Graphics g) { //清除記分牌 ()。 ( + 12 * , + 6 * , * 4, * 4)。 //計分 (0, 255, 0)。 (SCOREFONT)。 ( + score, + 14 * , + 8 * , | )。 }}
點擊復(fù)制文檔內(nèi)容
范文總結(jié)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1