⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 基于nokia手机的移动游戏开发(4).htm

📁 这是很好的J2ME实例教程,很适合初学者!
💻 HTM
📖 第 1 页 / 共 2 页
字号:
}
.center02 A:hover {
	COLOR: #194e00; TEXT-DECORATION: underline
}
</STYLE>

<TABLE cellSpacing=0 cellPadding=0 width=760 align=center bgColor=#f3f3f3 
border=0 valign="top">
  <TBODY>
  <TR class=center01>
    <TD style="PADDING-LEFT: 10px; PADDING-TOP: 10px" width=488><A 
      href="http://act.it.sohu.com/book/index.php">连载</A> &gt; <A 
      href="http://act.it.sohu.com/book/slist.php?class1=6">程序设计</A> &gt; <A 
      href="http://act.it.sohu.com/book/slist.php?class2=7">Java</A> &gt; <A 
      href="http://act.it.sohu.com/book/serialize.php?id=461">Java手机游戏开发专辑</A> 
    </TD>
    <TD style="PADDING-LEFT: 10px; PADDING-TOP: 10px" width=280>
      <DIV align=center><FONT color=#0000ff><A 
      href="http://act.it.sohu.com/book/chapter.php?id=461&amp;volume=4&amp;chapter=9">上一页</A></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      <FONT color=#0000ff><A 
      href="http://act.it.sohu.com/book/serialize.php?id=461">回书目</A></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      <FONT color=#0000ff><A 
      href="http://act.it.sohu.com/book/chapter.php?id=461&amp;volume=4&amp;chapter=11">下一页</A></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      </DIV></TD></TR>
  <TR class=center01>
    <TD style="PADDING-LEFT: 10px; PADDING-TOP: 10px" align=middle 
    colSpan=2>&nbsp;</TD></TR>
  <TBODY>
  <TR>
    <TD align=middle colSpan=2><BR>
      <DIV style="FONT-SIZE: 18pt; COLOR: #990000; FONT-FAMILY: 楷体_GB2312" 
      align=center><B>Java手机游戏开发实例</B></DIV><BR>
      <DIV style="FONT-SIZE: 18px; COLOR: #990000; FONT-FAMILY: ; 宋体: " 
      align=center>基于Nokia手机的移动游戏开发(4)</DIV>
      <DIV 
      style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FONT-SIZE: 10.5pt; COLOR: black; LINE-HEIGHT: 180%" 
      align=left><BR>&nbsp;&nbsp;&nbsp;&nbsp;
      <P><SPAN class=f14>  3 游戏屏幕<BR><BR>  如果用户从主菜单中选择"New 
      game",那么开始游戏并且显示游戏屏幕。游戏屏幕使用全屏画布(FullCanvas)。如果按下任何功能键,那么用户界面必须返回主菜单,并且应使游戏暂停。其他的按键对游戏是有效的。注意:游戏不应该在屏幕上创建任何功能键的标签。如果必须使用功能键标签,那么应用程序应该使用默认的Canvas屏幕Commands。示例代码没有解决诸如线程和线程安全等问题,这些问题在设计的时候必须格外注意。下面的代码是游戏屏幕的框架。<BR><BR></P>
      <TABLE width="100%" bgColor=#ffffff>
        <TBODY>
        <TR>
          <TD>import javax.microedition.lcdui.*;<BR>import 
            com.nokia.mid.ui.*;<BR>public class GameFullCanvas extends 
            FullCanvas {<BR>private GameMIDlet parent = null;<BR>private 
            MainMenu menu = null;<BR>private boolean gamePaused = 
            false;<BR>public GameFullCanvas(GameMIDlet parent, MainMenu menu) 
            {<BR>this.parent = parent;<BR>this.menu = menu;<BR>}<BR>protected 
            void paint(Graphics g) {<BR>//Paint the game screen 
            here<BR>}<BR>protected void keyPressed(int keyCode) {<BR>if (keyCode 
            == KEY_SOFTKEY1 || keyCode == KEY_SOFTKEY2<BR>|| keyCode == 
            KEY_SOFTKEY3) {<BR>gamePaused = true;<BR>//main menu to the 
            screen<BR>menu.init(parent);<BR>parent.setDisplayable(menu);<BR>}<BR>}<BR>public 
            void gameContinue() {<BR>gamePaused = false;<BR>}<BR>public boolean 
            isPaused() {<BR>return 
      gamePaused;<BR>}<BR>}</TD></TR></TBODY></TABLE><BR>  4 
      游戏选项屏幕<BR><BR>  用户可以通过选择主菜单中的"Options"选项改变特定的游戏选项。Options列表是固有的列表,包含处理游戏设置的条目,例如:声音、振动(见一、8节)、音调等等。如果要回到主菜单的话,需要使用Back命令。下面的代码是Options列表的框架。<BR><BR>  注意:如果游戏被安装到Games菜单的话,就不需要lights/sounds设置条目了,因为那些选项已经由Games菜单提供了。<BR><BR>
      <TABLE width="100%" bgColor=#ffffff>
        <TBODY>
        <TR>
          <TD>import javax.microedition.lcdui.*;<BR>public class OptionList 
            extends List implements CommandListener {<BR>private GameMIDlet 
            parent = null;<BR>private MainMenu menu = null;<BR>private 
            KeyDefinitions def = null;<BR>private Command back = new Command("", 
            Command.BACK, 2);<BR>public OptionList(String p0, int p1, String[] 
            p2, Image[] p3,<BR>GameMIDlet parent, MainMenu menu) {<BR>super(p0, 
            p1, p2, p3);<BR>this.menu = menu;<BR>init(parent);<BR>}<BR>public 
            OptionList(String p0, int p1, GameMIDlet parent,<BR>MainMenu menu) 
            {<BR>super(p0, p1);<BR>this.menu = 
            menu;<BR>init(parent);<BR>}<BR>private void init(GameMIDlet parent) 
            {<BR>this.parent = 
            parent;<BR>this.addCommand(back);<BR>this.setCommandListener(this);<BR>//These 
            are just a examples for the game specific 
            options<BR>this.append(Resources.getString(Resources.ID_GAME_LEVEL),<BR>null);<BR>this.append(Resources.getString(Resources.ID_GAME_SOUNDS),<BR>null);<BR>this.append(Resources.getString(Resources.ID_GAME_VIBRA),<BR>null);<BR>}<BR>public 
            void commandAction(Command p0, Displayable p1) {<BR>if (p0 == back) 
            {<BR>parent.setDisplayable(menu);<BR>}<BR>else {<BR>List lis = 
            (List) p1;<BR>int idx = lis.getSelectedIndex();<BR>switch (idx) 
            {<BR>case 0:<BR>//TODO<BR>break;<BR>case 
            1:<BR>//TODO<BR>break;<BR>case 2:<BR>//TODO<BR>break;<BR>case 
            3:<BR>parent.setDisplayable(def);<BR>break;<BR>//More if 
            needed<BR>default:<BR>break;<BR>}<BR>}<BR>}<BR>}</TD></TR></TBODY></TABLE></SPAN><BR><BR></DIV></TD></TR>
  <TR>
    <TD class=center01>
      <DIV align=center>来源:天极网 作者:
      <DIV></DIV></DIV></TD>
    <TD class=center01 width=280>
      <DIV align=center><FONT color=#0000ff><A 
      href="http://act.it.sohu.com/book/chapter.php?id=461&amp;volume=4&amp;chapter=9">上一页</A></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      <FONT color=#0000ff><A 
      href="http://act.it.sohu.com/book/serialize.php?id=461">回书目</A></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      <FONT color=#0000ff><A 
      href="http://act.it.sohu.com/book/chapter.php?id=461&amp;volume=4&amp;chapter=11">下一页</A></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      </DIV></TD></TR></TBODY></TABLE>
<TABLE>
  <TBODY>
  <TR>
    <TD width=760>
      <TABLE height=10 cellSpacing=0 cellPadding=0 width=760 border=0>
        <TBODY>
        <TR>
          <TD></TD></TR></TBODY></TABLE><!------------ 评论 ---------------->
      <TABLE cellSpacing=0 cellPadding=0 width=760 border=0>
        <TBODY>
        <TR>
          <TD><IFRAME id=vs src="基于Nokia手机的移动游戏开发(4).files/comment_list1.htm" 
            frameBorder=0 width="100%" 
      scrolling=no></IFRAME></TD></TR></TBODY></TABLE><BR>
      <SCRIPT language=javascript>function CheckNetwordForm(theForm){        if("" == theForm.content.value)        {                alert("写两句吧~~");                theForm.content.focus();                return false;        }        var index;        for(index=0;index<theForm.content.value.length;index++)        {                if(" " != theForm.content.value.charAt(index))                        break;        }        if(index == theForm.content.value.length) {                alert("写两句吧~~");                theForm.content.focus();                return false;        }        if (theForm.content.value.length>100){                alert("评论字数不能超过100哦");                theForm.content.focus();                return false;        }        return true;}</SCRIPT>
<!------------------ 评论 --------------->
      <FORM name=netword onsubmit="javascript: return CheckNetwordForm(this);" 
      action=insertnetword.php method=post>
      <TABLE cellSpacing=0 cellPadding=0 width=760 border=0>
        <TBODY>
        <TR>
          <TD class=text6 height=25>&nbsp;给此书打分:<A name=1></A> <SELECT 
            name=score> <OPTION value=5 selected>非常好</OPTION> <OPTION 
              value=4>还凑合</OPTION> <OPTION value=3>一般吧</OPTION> <OPTION 
              value=2>不太行</OPTION> <OPTION value=1>太差了</OPTION></SELECT> &nbsp; 
            用户名: <INPUT id=id type=hidden value=461 name=id> <INPUT type=hidden 
            value=/book/chapter.php?id=461&amp;volume=4&amp;chapter=10 
            name=backurl> <INPUT id=username maxLength=20 name=username> <FONT 
            color=#666666>*评论字数请控制在一百字以内</FONT> </TD></TR></TBODY></TABLE><BR>&nbsp;<TEXTAREA id=description name=content rows=4 wrap=off cols=80></TEXTAREA> 
<INPUT type=submit value=提交 name=Submit> 
</FORM></TD></TR></TBODY></TABLE></TD></TR></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=760 border=0>
  <TBODY>
  <TR>
    <TD width=1003 background=基于Nokia手机的移动游戏开发(4).files/t_bj01.gif 
      height=9><IMG height=1 src="" width=1></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=760 bgColor=#ffffff border=0>
  <TBODY>
  <TR>
    <TD>
      <HR width=760 noShade SIZE=1>
    </TD></TR>
  <TR>
    <TD align=middle><A class=black href="http://www.chinaren.com/" 
      target=_blank>ChinaRen</A> - <A class=black 
      href="http://big5.www.sohu.com/" target=_blank>繁体版</A> - <A class=black 
      href="http://hr.sohu.com/hrm.html" target=_blank>搜狐招聘</A> - <A class=black 
      href="http://add.sohu.com/" target=_blank>网站登录</A> - <A class=black 
      href="http://help.sohu.com/" target=_blank>帮助中心</A> - <A class=black 
      href="http://book.news.sohu.com/onClick=this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.sohu.com');return" 
      target=_blank false;>设置首页</A> - <A class=black 
      href="http://adinfo.sohu.com/" target=_blank>广告服务</A> - <A class=black 
      href="http://www.sohu.com/about/lianxi.htm" target=_blank>联系方式</A> - <A 
      class=black href="http://www.sohu.com/about/privacy.html" 
      target=_blank>保护隐私权</A> - <A class=black href="http://www.sohu.com/about/" 
      target=_blank>About SOHU</A> - <A class=black 
      href="http://www.sohu.com/about/" target=_blank>公司介绍</A><BR><SPAN 
      class=eng>Copyright &copy; 2004 Sohu.com Inc. All rights reserved. 搜狐公司 
      版权所有</SPAN> </TD></TR></TBODY></TABLE></CENTER><!-- START NNR Site Census V5.1 --><!-- COPYRIGHT 2004 Nielsen // Netratings -->
<SCRIPT language=JavaScript type=text/javascript>
<!--
	var _rsCI="cn-sohu";
	var _rsCG="0";
	var _rsDT=0;
	var _rsDU=0; 
	var _rsDO=0; 
	var _rsX6=0;  
	var _rsSI=escape(window.location);
	var _rsLP=location.protocol.indexOf('https')>-1?'https:':'http:';
	var _rsRP=escape(document.referrer);
	var _rsND=_rsLP+'//secure-cn.imrworldwide.com/';

	if (parseInt(navigator.appVersion)>=4)
	{
		var _rsRD=(new Date()).getTime();
		var _rsSE=1;	
		var _rsSV="";
		var _rsSM=0.01;
		_rsCL='<scr'+'ipt language="JavaScript" type="text/javascript" src="'+_rsND+'v51.js"><\/scr'+'ipt>';
	}
	else
	{
		_rsCL='<img src="'+_rsND+'cgi-bin/m?ci='+_rsCI+'&cg='+_rsCG+'&si='+_rsSI+'&rp='+_rsRP+'">';
	}
	document.write(_rsCL);
//-->
</SCRIPT>
<NOSCRIPT><IMG alt="" src="基于Nokia手机的移动游戏开发(4).files/m.gif"> </NOSCRIPT><!-- END NNR Site Census V5.1 -->
<SCRIPT language=JavaScript 
src="基于Nokia手机的移动游戏开发(4).files/nnselect.js"></SCRIPT>
<NOSCRIPT><IMG height=1 src="" width=1> </NOSCRIPT></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -