【正文】
// flush to the screen flushGraphics()。 } } } public void run() { Graphics g = getGraphics()。 } // draw time on the top right ((), getWidth(), 0, | )。 } } // sets the camera location private void setupCamera() { 本科課程設(shè)計論文 23 (angley, 0f, 1f, 0f)。amp。 UP_PRESSED) != 0) { // move forward, but first check if it is allowed if (canMove(stepx, stepz, true)) { locationx = stepx。 moved = true。 if (selected instanceof Mesh) { transparentMesh = ((Mesh) selected)。 if (distance = ) { return false。 float z = locationz + stepz。 (, )。 ()。 (0, locationSquareAppearance)。 Image locationSquareImage = (/)。 (0, floorAppearance)。 Image floorTextureImage = (/)。 // define the location and size of the floor Transform floorTransform = new Transform()。 (2, 8000, new float[]{trans[0], trans[1] + WALL_HEIGHT / 4, trans[2]})。 // is not pickable either (false)。 } // create the start mesh Plane startMarkPlane = ()。 (0, startMarkTexture)。 (markCompositeMode)。 setupCamera()。 createFloor()。 (0f, 0f,MAZE_SIDE_LENGTH)。 (camera)。 // sets the actual active camera if (topView) { (topCamera)。 } // stops/pauses the game void stop() { duration = () gameStart。 private Maze maze = new Maze(10, MAZE_SIDE_LENGTH, WALL_HEIGHT)。 // the world of the application private World world。 // flags whether we are looking the game from the top private boolean topView = false。 // amount to advance at each step private final static float STEP = 。這個時候我是非??释粋€團隊的,起碼大家一起想會周到一些。 try { image = (filename)。 (this).setCurrent( new Graphics3DProperties(g3d, this))。 } // starts a new ga,e void newGame() { ()。 } else { Alert splashScreen = new Alert(Maze3D, null, splash, )。 //Construct the midlet public Maze3DMIDlet() { error = makeImage(/)。 本科課程設(shè)計論文 3 圖一 歡迎界面 圖二 游戲列表 圖三 開始游戲 圖四 游戲界面 圖五 游戲地圖 本科課程設(shè)計論文 4 代碼實現(xiàn) import .*。針對不同的游戲部分,進行不同的細化。 : 定義角色文件 。 由于移動終端的類型成千上萬,而且計算能力差異非常大,不可能像桌面系統(tǒng)那樣僅僅兩三個版本的 JVM 即可滿足 Windows, Linux 和 Unix 系統(tǒng),因此, J2ME不是一個簡單的微型版的 JVM。 三、設(shè)計要求: 人工智能技術(shù) 好的人工智能技術(shù)是吸引游戲玩家的主要技術(shù)手段之一,本次設(shè)計之中,將會融入人工智能技術(shù),比如:追逐、躲避等 動態(tài)地圖生成技術(shù) 在 3D 迷宮類游戲之中,將采用動態(tài)生成地圖的技術(shù),每次游戲動態(tài)生成不同的地圖,增加游戲的可玩性,使玩家不易厭倦此游戲。 3D 游戲技術(shù) 利用 JSR184 標準及相關(guān) API 進行 3D 游戲的開發(fā),因為對于這個領(lǐng)域,到 目前為止,我還比較陌生,這將是我要解決的首要問題。為了滿足千 差萬別的移動設(shè)備的需求, SUN 定義了一系列的針對不同類型設(shè)備的規(guī)范,因此, J2ME 平臺便是由許多的規(guī)范組成的集合。 : 顯示歡迎界面和主菜單文件 。爾后將進行美工及編碼的設(shè)計過程。 import .*。 splash = makeImage(/)。 (3000)。 ()。 } // switches the canvas39。 } catch (Exception e) { (error loading image)。 遇到困難有同學和老師的幫助和指導,讓我對 J2ME 這門課程產(chǎn)生了濃厚的興趣。 // amount to rotate each time private final static float ANGLE_STEP = 。 本科課程設(shè)計論文 9 // flags to keep the drawing going private volatile boolean playing = true。 // the world has 2 cameras private Camera camera, topCamera。 private Thread mainThread = null。 playing = false。 } else { (camera)。 (topCamera)。 本科課程設(shè)計論文 12 //(0f, 0f, * MAZE_SIDE_LENGTH)。 createLocationSquare()。 start()。 // The label39。 } Texture2D endMarkTexture = null。 Mesh startMarkMesh = ()。 // Create a sequence of 4 keyframes KeyframeSequence keyframes = new KeyframeSequence(4,3, )。 (3, 12020, 本科課程設(shè)計論文 15 new float[]{trans[0], trans[1], trans[2]})。 (, , , )。 if (floorTextureImage != null) { floorTexture = new Texture2D( new Image2D(, floorTextureImage))。 // the floor is not pickable (false)。 if (locationSquareImage != null) { locationSquareTexture = new Texture2D( new Image2D(, locationSquareImage))。 (false)。 (wallClearCompositeMode)。 // set the texture (0, wallTexture)。 // First check if inside the maze area float mazeSize = MAZE_SIDE_LENGTH / 2 2。 } } } if (!forward) { // revert to the original view (180, 0f, 1f, 0f)。 (0, wallClearAppearance)。 } else if ((keyState amp。 locationz = stepz。 (locationx, locationz, 4f)) { finished = true。 (lo