【正文】
eless Toolkit(JWT)version ,這樣對(duì)于游戲中包含的類(lèi),字節(jié)碼驗(yàn)證器在打包前對(duì)它們進(jìn)行驗(yàn)證。它的功能包括了編譯、打包、模擬執(zhí)行 MIDP 應(yīng)用程序。每個(gè)版本都包括英語(yǔ),日語(yǔ),簡(jiǎn)體中文,繁體中 文 4 個(gè)語(yǔ)種包。即 MIDP 、 CLDC 、 WMA 、 MMAPI 、 Web Services(JSR 172)、 File and PIM APIs(JSR 75)、 Bluetooth and OBEX APIs(JSR 182)和 3DGraphics(JSR 184),同時(shí)也可以使用該版本開(kāi)發(fā)面向 和 的應(yīng)用程序。 安裝 WTK 后,將得到一個(gè)包括多種實(shí)用工具的開(kāi)發(fā)包。 JAD描述文件與其指定的 JAR文件需在同一個(gè)目錄下。形成的 JAR 保存在項(xiàng)目對(duì)應(yīng)的 bin 目錄下,如下圖: 圖 4 創(chuàng)建一個(gè)包 KToolBar 除了“產(chǎn)生包”,另外還有“產(chǎn)生混淆包”功能。 在需要監(jiān)視程序性能的時(shí)候,可以 在 EditPreferences 里 選中“ Enable Memory Monitor”,在下一次模擬器執(zhí)行的時(shí)候, 就可讀出程序運(yùn)行時(shí)的內(nèi)存消耗均值,消耗峰 值以及具體產(chǎn)生對(duì)象的個(gè)數(shù)使用情況。 人們一開(kāi)始并沒(méi)預(yù)料到它將會(huì)有如此廣泛的吸引力。 俄羅斯方塊 經(jīng)常被稱(chēng)為拼圖游戲。因而每個(gè)人玩這個(gè)游戲都會(huì)有一次不同的體驗(yàn)。在游戲進(jìn)程中,積木落下來(lái)的速度越來(lái)越快,這樣對(duì)玩家的挑戰(zhàn)也就越來(lái)越大,游戲的難度也逐步增加。當(dāng)屏幕底端的方塊拼滿(mǎn)一橫行時(shí),這個(gè)層的方塊就會(huì)消失,而這一行以上的所有方塊都會(huì)下降一層。這個(gè)游戲當(dāng)中沒(méi)有任何探險(xiǎn)成分在內(nèi),它不會(huì)讓玩 家真正大吃一驚,玩家能夠看到讓游戲順利進(jìn)行下去的所有信息,所以玩家輸了的話(huà)只能怪他自己。一旦玩家拼好了一幅拼圖,只要他還記得他是怎么拼的,那么這個(gè)拼圖就對(duì)他再也無(wú)挑戰(zhàn)了。積木一堆到盒子頂部,玩家就輸了。 (4)最高分機(jī)制: 俄羅斯方塊引入一個(gè)計(jì)分模式,它給玩家計(jì)分并把分?jǐn)?shù)記錄在高分排行榜上。這意味著,不論是否熟悉計(jì)算機(jī)游戲,任何人都可以走過(guò)來(lái)并立即開(kāi)始玩它。 系統(tǒng)總體結(jié)構(gòu) 系統(tǒng)開(kāi)發(fā)的主要任務(wù)是俄羅斯方塊游戲在無(wú)線(xiàn)移動(dòng)端的實(shí)現(xiàn)。比如, 積滿(mǎn) 一行后消減;能夠快速直接的下落;記錄游戲最高 分;方塊翻轉(zhuǎn);分?jǐn)?shù)計(jì)算; 隨機(jī)生成方塊 ,見(jiàn)下圖: 進(jìn)入游戲 按鍵輸入 (0- 9)選 擇關(guān)卡難度 處理輸入 選擇 關(guān)卡難度 進(jìn)入關(guān)卡 0 進(jìn)入關(guān)卡 1 進(jìn)入關(guān)卡 2 進(jìn)入關(guān)卡 3 。建了兩個(gè)包作為功能劃分,分別為: ui 包和 model 包。 (x, y, width, height)。 if( != blockType) { // 繪制下落時(shí)的陰影 ()。 } else { //繪制顏色 ()。 COLOR_BLACK為 TetrisConstants下定義的預(yù)設(shè) RGB顏色,初始值為 0x00000000。 } else { ()。 // 檢查方塊的每一行,看是否以完成 for(int i = 0。 } } int numClearedRows = 0。 } if((y)) { numClearedRows++。 i++) { (i)。實(shí)現(xiàn)效果如下圖: 圖 17 游戲進(jìn)行狀態(tài)圖 在 前面 部分通過(guò)圖 9的 系統(tǒng)生命周期流程圖,已經(jīng)了解了游戲中斷處理的過(guò)程。 // 進(jìn)入暫停狀態(tài)并停止下落 ()。 // 進(jìn)入運(yùn)行狀態(tài)并下落 ()。 下面用方塊 I 舉例說(shuō)明其進(jìn)行翻轉(zhuǎn)判斷的代碼: private void setAsNewIPiece(int x, int y) { = 。 (1, x , y)。 //判斷翻轉(zhuǎn)方向 (x,y) (y,x) 如向左旋轉(zhuǎn): (y,x) 如向右旋轉(zhuǎn): (y,x) (y+1,x+1) (y+1,x+1) = !。 int blockY = (i)。 } else { // 如向右旋轉(zhuǎn) dy *= 1。//得到翻轉(zhuǎn)后的新坐標(biāo) } } 方塊處理模塊功能 對(duì)當(dāng)前下落方塊的處理,主要功能是及時(shí)刷新圖像,保證方塊狀態(tài)及時(shí)更新。 x++) { if( == (x, rowY)) { // 有空方塊,行不被填充 return false。其實(shí)現(xiàn)由 init()方法控制,其代碼如下: private void init() { = new TetrisBoard()。 //初始化數(shù)組 = ()。 ()。并展示了在 WTK 中打開(kāi)一個(gè)項(xiàng)目、把源文件打包成 JAR包、產(chǎn)生混淆包的方法和過(guò)程。最終展示了無(wú)線(xiàn)網(wǎng)絡(luò)移動(dòng)端的游戲開(kāi)發(fā)的基本開(kāi)發(fā)過(guò)程和設(shè)計(jì)思路。在 Java ME 這種面向?qū)ο?、高移植性的語(yǔ)言平臺(tái)進(jìn)行開(kāi)發(fā)是大多數(shù)無(wú)線(xiàn)網(wǎng)絡(luò)移動(dòng)端游戲開(kāi)發(fā)者的首選。 [3] Richard [M].北京: 電子工業(yè)出版社 ,2020。 [7] Joshua Bloch,Neal [M].北京: 人民郵電出版社 ,2020。 致 謝 本文是在吳震老師和李曉崗老師的熱情關(guān)心和指導(dǎo)下完成的,他們淵博的知識(shí)和嚴(yán)謹(jǐn)?shù)闹螌W(xué)作風(fēng)使我受益匪淺,對(duì)順利完成本課題起到了極大的作用。 關(guān)于學(xué)位 論文使用權(quán)和研究成果知識(shí)產(chǎn)權(quán)的說(shuō)明 本人完全了解成都信息工程學(xué)院有關(guān)保管使用學(xué)位論文的規(guī)定,其中包括: ( 1) 學(xué)校有權(quán)保管并向有關(guān)部門(mén)遞交學(xué)位論文的原件與復(fù)印件。 ( 5) 學(xué)??梢怨紝W(xué)位論文的全部或部分內(nèi)容 (保密學(xué)位論文在解密后遵守此規(guī)定 )。 and they sang before him, and he was glad. But for a long while they sang only each alone, or but few together, while the rest hearkened。 Then the voices of the Ainur, like unto harps and lutes, and pipes and trumpets, and viols and ans, and like unto countless choirs singing with words, began to fashion the theme of Il 鷙 atar to a great music。 and he lifted up his left hand, and a new theme began amid the storm, like and yet unlike to the former theme, and it gathered power and had new beauty. But the discord of Melkor rose in uproar and contended with it, and again there was a war of sound more violent than before, until many of the Ainur were dismayed and sang no longer, and Melkor had the mastery. Then again Il 鷙 atar arose, and the Ainur perceived that his countenance was stern。 and it had little harmony, but rather a clamorous unison as of many trumpets braying upon a few notes. And it essayed to drown the other music by the violence of its voice, but it seemed that its most triumphant notes were taken by the other and woven into its own solemn pattern. In the midst of this strife, whereat the halls of I l 鷙 atar shook and a tremor ran out into the silences yet unmoved, Il 鷙 atar arose a third time, and his face was terrible to behold. Then he raised up both his hands, and in one chord, deeper than the Abyss, higher than the Firmament, piercing as the light of the eye of Il 鷙 atar, the Music ceased. Then Il 鷙 atar spoke, and he said: 39。 and Melkor was f illed w ith sham e, of which came secret anger. But Il 鷙 a tar arose in splendour, and he went forth from the fair regions that he had made for the Ainur。 a rid they saw a new World made visible before them, and it was globed amid the Void, and it was susta ined therein, but was not of it. And as they looked and wondered this World began to unfold its history, and it seemed to them that it lived and grew. And w hen the Ainur had gazed for a while and were silent, I l 鷙 atar said again: 39。 for to none but himself has Il 鷙 atar revealed all that he has in store, and in every age there e forth things that are new and have no foretelling, for they do not proceed from the past. And so it was tha t as this vision of the World was 。 and each of you shall find contained herein, amid the design that I set before you, all those things which it may seem that he himself devised or added. And thou, Melkor, w ilt discover all the secret thoughts of thy mind, and wilt perceive that they are but a part of the whole and tributary to its glory.39。Behold your Music!39。 but that he may know, and all the Ainur, that I am Il 鷙 atar, those things that ye have sung, I will show them forth, that ye may see what ye have done. And thou, Melkor, shalt see that no theme may be played that hath not its uttermost source in me, nor can any alter the music in my despite. For he that attempteth this shall prove but mine instrument in the devising of things more wonderful, which he himself hath not imagined.39。 but it could not be quenched, and it took to itself power and profundity. And it seemed at last that there were two musics progressing at one time before the seat of Il鷙 atar, and they were utterly at variance. The one was deep and wide and beautiful, but slow and blended w ith an immeasurable sorrow, from which its beauty chiefly cam