j2me设计论文-3d迷宫手机游戏内容摘要:

ce = new Appearance()。 // points to the mesh last made semi transparent private Mesh transparentMesh = null。 private Maze maze = new Maze(10, MAZE_SIDE_LENGTH, WALL_HEIGHT)。 private Thread mainThread = null。 // Construct the Displayable MazeCanvas(Maze3DMIDlet midlet) { 本科课程设计论文 10 super(true)。 = midlet。 } // (Re)Starts the game void start() { playing = true。 gameStart = () duration。 mainThread = new Thread(this)。 ()。 } // stops/pauses the game void stop() { duration = () gameStart。 playing = false。 } // switches from top view to normal view and vice versa void switchView() { topView = !topView。 setView()。 // informs the MIDLet since this can be switched internally ()。 } void setView() { // reset the locaiton and draw on top of the maze (locationx, 2 * WALL_HEIGHT + 3f, locationz)。 // the square is rendered only in top view (topView)。 // the background is removed in top view 本科课程设计论文 11 (topView ? null : background)。 // sets the actual active camera if (topView) { (topCamera)。 } else { (camera)。 } } // Builds the world void init() { setFullScreenMode(true)。 duration = 0。 // get a Graphics3D instance g3d = ()。 // build the world and the cameras world = new World()。 camera = new Camera()。 topCamera = new Camera()。 (camera)。 (topCamera)。 float w = (float)getWidth()。 float h = (float)getHeight()。 // set the perspective (, w / h, , )。 (, w / h, , )。 // the top camer has a fixed transform looking from the top Transform topCameraTransform = new Transform()。 (90, 1f, 0f, 0f)。 (0f, 0f,MAZE_SIDE_LENGTH)。 本科课程设计论文 12 //(0f, 0f, * MAZE_SIDE_LENGTH)。 (topCameraTransform)。 // Setup the background background = new Background()。 Image backgroundImage = (/)。 if (backgroundImage != null) { (new Image2D(, backgroundImage))。 (, )。 } (background)。 createFloor()。 createLocationSquare()。 setUpMaze()。 createStartEndMarks()。 setView()。 // setup the initial location locationx = ()。 locationz = ()。 // look at the center angley = 180f。 setupCamera()。 start()。 } // creates the labeld at the start and at the end of the maze private void createStartEndMarks() { // The marks39。 appearance Appearance startMarkAppearance = new Appearance()。 Appearance endMarkAppearance = new Appearance()。 本科课程设计论文 13 // The posite mode is ALPHA to show only the letters // the background is hidden using the alpha layer CompositingMode markCompositeMode = new CompositingMode()。 ()。 (markCompositeMode)。 (markCompositeMode)。 // The label39。 s text is built using a texture Texture2D startMarkTexture = null。 Image startMarkTextureImage = (/)。 if (startMarkTextureImage != null) { startMarkTexture = new Texture2D( new Image2D(, startMarkTextureImage))。 // the texture is not repeated (, )。 ()。 (, )。 (0, startMarkTexture)。 } Texture2D endMarkTexture = null。 Image endMarkTextureImage = (/)。 if (endMarkTextureImage != null) { endMarkTexture = new Texture2D( new Image2D(, endMarkTextureImage))。 // the texture is not repeated (, )。 ()。 本科课程设计论文 14 (, )。 (0, endMarkTexture)。 } // create the start mesh Plane startMarkPlane = ()。 Mesh startMarkMesh = ()。 (0, startMarkAppearance)。 // these are not pickable (false)。 (startMarkMesh)。 // creates the end mesh Plane endMarkPlane = ()。 Mesh endMarkMesh = ()。 (0, endMarkAppearance)。 // is not pickable either (false)。 // Create a sequence of 4 keyframes KeyframeSequence keyframes = new KeyframeSequence(4,3, )。 (12020)。 ()。 float[] trans = new float[4]。 (trans)。 // create set the keyframes. // Basically keep x and z and animate in the y axis (0, 0, new float[]{trans[0], trans[1], trans[2]})。 (1, 4000, new float[]{trans[0], trans[1] WALL_HEIGHT / 4, trans[2]})。 (2, 8000, new float[]{trans[0], trans[1] + WALL_HEIGHT / 4, trans[2]})。 (3, 12020, 本科课程设计论文 15 new float[]{trans[0], trans[1], trans[2]})。 AnimationTrack animationTrac。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。