J2ME应用开发课程设计报告书_第1页
J2ME应用开发课程设计报告书_第2页
J2ME应用开发课程设计报告书_第3页
J2ME应用开发课程设计报告书_第4页
J2ME应用开发课程设计报告书_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、J2ME应用程序开发课 程 设 计 报 告 书题 目: 赛车游戏 专 业: 计算机科学与应用系 学 号: 111006413 学生姓名: 李阳坡 指导教师: 臧利萍 完成日期: 2013年 12月23日 目录一 前 言31.1引 言31.2 J2ME简介41.2.1 概述41.2-1 Java技术的体系结构4二 开发平台及开发技术52.1 J2ME基础知识52.2.开发工具52.3  简单环境的搭建:6三 总体设计63.1需求分析63.2 系统功能结构图73.3开发环境需求73.4运行环境7四 详情设计8五 总结16 一 前 言1.1引 言 随着科学技术的发展,手机已经成为人们生活中

2、的必需品。手机的普及,特别是智能机时代的到来,手机软件的开发也成了必不可少。如何通过手机来吸引消费者的眼球,已经成为让很多商家之间的竞争热点。其中手机游戏也成为了其中的重大分支,如何让以前只能在电脑上的玩的游戏变成让人们随时随地都能玩的手机游戏已经成为现在游戏开发的主流。 J2ME的普及为手机游戏的发展提供了最适合的土壤。因为JVM的平台无关性使得标准的J2ME游戏几乎可以在所有内置了JVM的手机上运行,一方面提高了游戏的传播性,另一方面提高了开发者的积极性。于是逐渐开始有第三方公司专门从事J2ME游戏的开发,形成了手机游戏产业化。随着硬件水平的发展,手机游戏也一改往日的朴素形象,开始加入了更

3、多的媒体元素,由最早的黑白两色、单音发展到了彩色动画与和弦音效甚至3D加立体声,手机厂商甚至推出了专门的游戏手机,如诺基亚的N-Gage。然而更多的情况下,手机只是PC与游戏机的一种替代。条件满足的话,人们肯定更愿意选择速度与交互性都更加出色的后者。与之相比,手机游戏最大的优势便是其易携性与网络支持性。因为它的易携,使得它可以满足人们随时随地玩游戏的需求,是无聊时打发时间的最好选择。至于网络支持性,在目前网络带宽有限的情况下优势还不明显,预计在将来成为手机网游发展的最大助力。基于以上差别,目前最有可能成功的手机游戏就是那些临时小游戏,它可为广泛的玩家在所有的社交场合提供娱乐。1.2 J2ME简

4、介1.2.1 概述Java ME(Java Platform,Micro Edition)是为机顶盒、移动电话和PDA之类嵌入式消费电子设备提供Java语言平台,包括虚拟机和一系列标准化的Java API。它和Java SE、Java EE一起构成Java技术的三大版本,并且同样是通过JCP(Java Community Process)制订。Java ME(Java 2 Micro Edition)是Java 2的一个组成部分,它与J2SE、J2EE并称。根据Sun的定义:Java ME是一种高度优化的Java运行环境,主要针对消费类电子设备的,例如蜂窝电话和可视电话、数字机顶盒、汽车导航系

5、统等等。JAVA ME技术在1999年的JavaOne Developer Conference大会上正式推出,它将Java语言的与平台无关的特性移植到小型电子设备上,允许移动无线设备之间共享应用程序 1.2.2 Java技术的体系结构J2ME为运行在嵌入式消费类电子产品的设备,如移动电话、PDA、游戏终端之上的应用程序提供了一个健壮的、灵活的环境。与J2SE、J2EE和Java Card一样,J2ME同样包含一个小型的虚拟机和一系列的Java API。J2ME还提供了灵活的图形用户界面、健壮的安全模型、广泛的联网协议支持。目前J2ME平台已经部署到上亿个的设备上,前景非常看好。J2ME平台由

6、多种配置(Configuration)、简表(Profile)和可选包(Optional Package)组成。平台的实现者和应用程序的开发者可以从中选择并组合出一个完整的Java运行环境来满足特定范围内的设备需求。每种组合都应该使这一系列设备的内存、处理器和I/O能力达到最优化。J2ME专家组之所以采取这种灵活的设计结构主要是为了满足市场上不同种类的嵌入式设备的需求,这些设备在软件和硬件特性上都存在巨大的差异,一种规范很难将它们统一起来。二 开发平台及开发技术2.1 J2ME基础知识J2ME,即Java 2 Micro Edition,是SUN公司推出的在移动设备上运行的微型版Java平台,

7、常见的移动设备有手机,PDA,电子词典,以及各式各样的信息终端如机顶盒等等。最重要的移动终端当然是手机了,因此,我们主要讨论手机相关的J2ME规范。J2ME是Sun公司为嵌入式开发所定义的一个框架,一系列标准的规范所组成。所以J2ME是一个协议簇,而不是单一的规范。 3.2开发工具和环境搭配2.2.开发工具高级的MIDP应用程序开发工具能够帮助开发人员简化J2ME开发过程,包括Sun提供的官方开发工具WTK和手机厂商提供的专属SDK。J2ME Wireless Toolkit: WTK 的全称是Sun J2ME Wireless Toolkit Sun的无线开发工具包。这一工具包的设计目的是为

8、了帮助开发人员简化j2me的开发过程。该工具箱包含了完整的生成工具、实用程序以及设备仿真器。 J2ME 集成开发工具EclipseEclipse是一个开发源代码的、基于java的可扩展开发平台。Eclipse本身只是一个框架和一组响应的服务,并不能够开发什么程序。在Eclipse中几乎每样东西都是插件,实际上正是运行在Eclipse平台上的种种插件提供我们开发程序的各种功能。同时各个领域的开发人员通过开发插件,可以构建与Eclipse环境无缝集成的工具。 EclipseME作为Eclipse一个插件,致力于帮助开发者开发J2ME应用程序。EclipseME并不为开发者提供无线设备模拟器,而将各

9、手机厂商的实用模拟器紧密连接到Eclipse开发环境中,为开发者提供一种无缝统一的集成开发环境。 2.3  简单环境的搭建: 1、  下载JDK和J2ME无线工具包() 安装SUN JDK:j2sdk-1_4_0_03-windows=i386 安装SUN J2ME SDK:j2me_wireless_toolkit-1_0_3-win 2     关于Wireless Tool Kit WTK(Wireless Tool Kit)是Sun公司针对J2ME推出的用于手机和Palm等 移动设备的开发包,是除手机厂商的专用开发包外唯一的手

10、机模拟器开发包。 它通用性高,开发出的应用程序可保证能运行在大部分设备上,而不像专用 厂商具有一定的不兼容性。虽然它没有强大的功能和完善的调试手段,但它 提供运行模拟器的最基本组件,是其他IDE需集成采用的必备元素。 3, 用于手机游戏开发的环境不是只建立一个 java sdk 就可以了,它还需要了一个一个库类,叫 java toolkit。首先安装 java sdk 再在原来的目录下安装java toolkit这个新的环境就可以满足我们的需要了。然后我们编写一个最简单的程序用来验证这个环境是否可以用来编写我们的手机程序。 三 总体设计3.1需求分析此游戏是汽车速度竞技游戏,玩家通过操作自己的

11、赛车告诉行驶,并不断的超越其他车辆。游戏主要分为四个模块,开始游戏,游戏模式,游戏设置,游戏商城。开始游戏就是正式开始游戏,游戏模式分为标准模式 、追逐模式、和生存模式,玩家可以根据自己的爱好来选择相应的模式。游戏设置主要是对游戏的声音了 背景音乐等的选择;游戏商城可以供玩家进行购买各种道具和车辆。3.2 系统功能结构图开始游戏加载界面登录界面主菜单界面游戏模式游戏设置游戏商城3.3开发环境需求为了游戏者安装的方便以及游戏的兼容性,考虑到游戏者大多数用的都是Windows操作系统,游戏在Windows操作系统下开发,把游戏的兼容性问题降低到最低限度。游戏是Eclipse的环境下开发的。3.4运

12、行环境适用操作系统:Windows XP以上Windows操作系统。运行软件:jdk1.60 + Eclipse7.0+wireless 2.5.2。四 详情设计1 主菜单界面在这个界面主要分为五个部分。开始游戏、游戏模式、游戏设置、游戏商城和退出游戏等。开始游戏即进入游戏模式,开始游戏。关键代码: <TableLayout android:id="+id/linear0" android:layout_width="fill_parent" android:layout_height="fill_parent" android

13、:layout_alignParentLeft="true" android:layout_alignParentTop="true"> <LinearLayout android:id="+id/linear1" android:layout_width="wrap_content" android:layout_height="wrap_content" > <Button android:id="+id/change" android:layou

14、t_width="60dp" android:layout_height="wrap_content" android:text="兑换" android:textColor="#ffffff" android:layout_marginLeft="100dp" android:background="#11975b" /> <Button android:id="+id/about" android:layout_width="60

15、dp" android:layout_height="wrap_content" android:text="关于" android:textColor="#ffffff" android:layout_marginLeft="10dp" android:background="#11975b"/> <Button android:id="+id/help" android:layout_width="60dp" android:la

16、yout_height="wrap_content" android:text="帮助" android:textColor="#ffffff" android:layout_marginLeft="10dp" android:background="#11975b"/> </LinearLayout> <LinearLayout android:id="+id/start_logo" android:layout_width="wrap_c

17、ontent" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="150dp" android:background="drawable/logo_start_1" /></LinearLayout> <LinearLayout android:id="+id/linear2" andr

18、oid:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="+id/start" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="200dp" android:layout_marginTop=&

19、quot;60dp" android:textColor="#ffffff" android:background="drawable/youxi_start"/> </LinearLayout> <LinearLayout android:id="+id/linear3" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android

20、:id="+id/pattern" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_marginLeft="200dp" android:textColor="#ffffff" android:background="drawable/youxi_mode"/>

21、 </LinearLayout> <LinearLayout android:id="+id/linear4" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="+id/set" android:layout_width="wrap_content" android:layout_height="wrap_content

22、" android:layout_marginTop="10dp" android:layout_marginLeft="200dp" android:textColor="#ffffff" android:background="drawable/youxi_set"/> </LinearLayout> <LinearLayout android:id="+id/linear5" android:layout_width="wrap_content&

23、quot; android:layout_height="wrap_content"> <Button android:id="+id/sell" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_marginLeft="200dp" android:textColor=&qu

24、ot;#ffffff" android:background="drawable/youxi_mall"/> </LinearLayout> <LinearLayout android:id="+id/linear6" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="+id/exit" android:layou

25、t_width="100dp" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_marginLeft="0dp" android:textColor="#ffffff" android:background="drawable/youxi_quit"/> </LinearLayout> </TableLayout>2 游戏模式界

26、面 该游戏可分为三个模式,分别是标准模式、追逐模式和生存模式,其中标准模式比较简单,只进行一般的比赛即可。追逐模式则相对难度增大,必须追上目标并超过对方方可赢得比赛,最后是生存模式,该模式难度最大,在车辆被毁之后就要失去本次游戏的资格。代码: <Button android:id="+id/stand_mode" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="drawable/sta

27、ndard_mode"/> <Button android:id="+id/after_mode" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="drawable/after_model_"/> <TableLayout android:layout_width="match_parent" android:layout_he

28、ight="match_parent" android:background="drawable/survival_mode" android:gravity="bottom|left" > <TableRow android:id="+id/tableRow2" android:layout_width="fill_parent" android:layout_height="250dp" android:gravity="bottom|left&qu

29、ot; > <Button android:id="+id/button1" android:layout_width="wrap_content" android:layout_height="80dp" android:background="drawable/return_b" android:textSize="25sp" /> </TableRow> </TableLayout></LinearLayout>3 游戏设置界面游戏设置

30、界面,玩家可以根据自己的爱好对游戏进行相应的设置。主要是游戏声音,背景音乐和振动,游戏声音主要是指在游戏过程中的车辆碰撞,炸弹,加速等的声音。背景音乐是指在玩游戏的过程中,是否有音乐,振动主要是在车辆被毁时振动。<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent"

31、 android:orientation="vertical" android:background="drawable/setground"> <TableLayout android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:id="+id/button1" android:layout_width="fill_parent"

32、 android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_marginBottom="20dp" android:gravity="center_horizontal" android:background="drawable/setting_title"> </Button> <TableRow android:id="+id/tableRow1&q

33、uot; android:layout_width="fill_parent" android:layout_height="50dp" android:layout_marginTop="20dp"> <TextView android:id="+id/textView1" android:layout_width="100dp" android:layout_height="50dp" android:layout_marginLeft="10dp&

34、quot; android:layout_marginRight="10dp" android:background="drawable/ui_sound_open" /> <TextView android:id="+id/textView3" android:layout_width="200dp" android:layout_height="60dp" android:layout_gravity="center_vertical" android:tex

35、t="设置游戏的声音【关】" android:textColor="#ffffff" android:textSize="15sp" /> </TableRow> <TableRow android:id="+id/tableRow1" android:layout_width="fill_parent" android:layout_height="50dp" android:layout_marginTop="20dp">

36、 <Button android:id="+id/play" android:layout_width="100dp" android:layout_height="50dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:background="drawable/ui_music_open" /> <TextView android:id="+

37、id/textView3" android:layout_width="200dp" android:layout_height="60dp" android:text="设置游戏的背景音乐" android:textColor="#ffffff" android:textSize="15sp" /> </TableRow> <TableRow android:id="+id/tableRow1" android:layout_width=&

38、quot;fill_parent" android:layout_height="50dp" android:layout_marginTop="20dp"> <TextView android:id="+id/textView1" android:layout_width="150dp" android:layout_height="50dp" android:layout_marginLeft="10dp" android:layout_margin

39、Right="10dp" android:background="drawable/ui_vibration_close" /> <TextView android:id="+id/textView3" android:layout_width="200dp" android:layout_height="60dp" android:text="设置游戏的震动" android:textColor="#ffffff" android:textSize="15sp" /> </TableRow> <TableRow android:id=&q

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论