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

📄 用vb开发即时战略游戏.htm

📁 vb游戏编程文档(html)
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><LINK href="/style.css" rel=stylesheet type="text/css"><title>用VB开发即时战略游戏</title><script language="JavaScript" src="/js/common.js"> // </script><script language="JavaScript" type="text/JavaScript"><!--function MM_reloadPage(init) {  //reloads the window if Nav4 resizedif (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();}MM_reloadPage(true);//--></script><script language="JavaScript"><!--var filename = getFilename();if (filename.length > 0){if (filename.indexOf(".") > 0)filename= filename.substring(0, filename.indexOf("."));document.write("<script src='/inc/click.jsp?filename=" + filename + "'></script>");}//--></script><style type="text/css"><!----></style></head><body leftmargin="0" topmargin="0"><Script language="JavaScript" src="/top.js"> // </Script><table width="770" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td width="1" valign="top" bgcolor="C4C4C4"><img src="/images/x.gif" width="1" height="1"></td><td width="190" height="100%" valign="top"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><Script language="JavaScript" src="/login.js"> // </Script></td></tr><tr><td height="1"><img src="/images/blank.gif"></td></tr></table></td></tr><tr><td height="100%"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="1" class="t2_tb_bg01"><script language="JavaScript">document.write("<script src=\"/inc/zxtop10.jsp?id=92\"><\/script>");</script><tr><td height="2" class="t2_td_bg02"><img src="/images/blank.gif"></td></tr><tr><td height="100%" align="center" valign="top" class="t2_td_bg02"><Script language="JavaScript" src="/js/friendlink.js"> // </Script></td></tr></table></td></tr></table></td><td width="1" valign="top" bgcolor="#C4C4C4"><img src="/images/x.gif" width="1" height="1"></td><td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="11" background="/images/news_bg1.gif"><img src="/images/blank.gif"></td><td width="1" rowspan="2" class="tb_bg01"><img src="/images/blank.gif"></td></tr></table><table width="577" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td width="20" background="/images/nhl.jpg"><img src="/images/nhl.jpg" width="1" height="24"></td><td background="/images/nhl.jpg">当前位置:<a href="/softnews/index.jsp">技术导读</a>&nbsp;&gt;&gt;&nbsp;<a href="/news/news_subcata.jsp?id=94">编程语言</a>&nbsp;&gt;&gt;&nbsp;<a href="/news/news_subcata.jsp?id=92">VB</a></td><td align="right" background="/images/nhl.jpg"><Script language="JavaScript" src="/js/search1.js"> // </Script></td></tr></table><table width="577" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td bgcolor="#C4C4C4"><img src="/images/x.gif" width="1" height="1"></td></tr></table><table width="577" border="0" cellspacing="0" cellpadding="0"><tr><td width="20%">&nbsp;</td><td height="30" align="right">【<a href="#" onClick="javascript:window.open('/inc/email.jsp?type=news&id='+filename,'',''); return false;">email给朋友</a>】浏览字号:【<a href="javascript:doZoom(24)" class="A2">大</a> <a href="javascript:doZoom(18)" class="A2">中</a> <a href="javascript:doZoom(12)" class="A2">小</a>】 【<span class="style3"><a href="javascript:doPrint()">打印</a></span>】 【<span class="style3"><a href="javascript:window.close()">关闭窗口</a></span>】</td></tr></table><div id=article><table width="577" border="0" cellspacing="0" cellpadding="0"><tr><td>&nbsp;</td></tr></table><table width="577" border="0" cellspacing="0" cellpadding="0"><tr><td width="30">&nbsp;</td><td id="zoom" style="font-size:14.8px" class="news-txt"><p align=center style='color:#525252; font-weight:bolder;'>用VB开发即时战略游戏</p><P>  先解释一下设计方法。 </P>
<P>  1.这叫棋子操纵模式。 </P>
<P>  2.回合制采用单方棋子操纵模式,也就是敌方棋子由电脑操纵,使用者棋子由使用者操纵。 </P>
<P>  3.即时制采用双方棋子操纵模式,也就是双方棋子都由电脑操作,只是电脑允许使用者改变我方棋子行为模式而已。 </P>
<P>  4.我们可以这么想,电脑由一个时间器(Timer) 隔一段时间去动一下敌我双方的所有旗子,也就是说使用者如果不动作,其实就是看电脑自己在下棋。 </P>
<P>  5.但一旦使用者指定某棋子时,该棋子移动指标就被标为 False ,如此电脑在每一棋步中碰到该棋子就不会对它有所动作,但其他棋子则继续动作,直到使用者设定完该棋子行动方式后,行动指标恢复为 True ,意思就是继续交还电脑控管。 </P>
<P>  6.用一个最简单的 VB 模型来说明: </P>
<P>    Type 棋子模式 </P>
<P>    行动指标 As Boolean </P>
<P>    行为模式 As SomeValue </P>
<P>    End Type </P>
<P>  '假设有十颗棋子 </P>
<P>  Dim 棋子(9) AS 棋子模式 </P>
<P>    Sub Form_Load() </P>
<P>    Dim I As Long </P>
<P>  棋子(0).行为模式=敌A </P>
<P>    棋子(1).行为模式=敌B </P>
<P>    . </P>
<P>    . </P>
<P>    棋子(5).行为模式=我A </P>
<P>    棋子(6).行为模式=我B </P>
<P>    . </P>
<P>    . </P>
<P>    For I=0 To Ubound(棋子)-1 </P>
<P>    棋子.行动指标=True </P>
<P>    Next </P>
<P>    End Sub </P>
<P>  Sub 棋子_Click(Index As Integer) </P>
<P>    棋子(Index).行动指标=False </P>
<P>    Call 行为模式改变(Index) </P>
<P>    End Sub </P>
<P>  Sub 行为模式改变(Byval 传入值) </P>
<P>    '...............行为模式改变设定 </P>
<P>    棋子(传入值).行为模式 =新行为模式 </P>
<P>    棋子(传入值).行动指标=True </P>
<P>    End Sub </P>
<P>  Sub Timer_Timer() </P>
<P>    Dim I As long </P>
<P>    For I=0 to UBound(棋子)-1 </P>
<P>    If 棋子(I).行动指标=True Then </P>
<P>      Call 棋子行动 (棋子(I).行为模式) </P>
<P>    End If </P>
<P>    Next </P>
<P>    End Sub </P>
<P>  Sub 棋子行动(ByVal 传入值) </P>
<P>    Select Case 传入值 </P>
<P>    Case 敌A </P>
<P>     敌A 模式行动展开 </P>
<P>    Case 敌B </P>
<P>     敌B 模式行动展开 </P>
<P>     . </P>
<P>     . </P>
<P>    Case 我A </P>
<P>     我A 模式行动展开 </P>
<P>    Case 我B </P>
<P>     我B 模式行动展开 </P>
<P>    . </P>
<P>    . </P>
<P>    End Sub </P>
<P>  至于战车跑几步,士兵发几枪,被 K 多少下才会隔屁,可借行为模式的增加来设定,不过这种各兵种不同属性的设定,不管回合制或即时制都需要有此种机制,不构成双方分别的要件。</P></td><td width="30">&nbsp;</td></tr></table><table width="577" border="0" cellspacing="0" cellpadding="0"><tr><td width="30" height="50">&nbsp;</td><td width="547" valign="bottom" class="normal_f">出处:搜狐IT&nbsp;&nbsp;&nbsp;&nbsp;日期:2005-04-14</td></tr></table></div><table width="577" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="#C4C4C4"><img src="/images/x.gif" width="1" height="1"></td></tr></table><table width="577" border="0" cellspacing="0" cellpadding="0"><tr><td width="100%" bgcolor="#C4C4C4"><script language="JavaScript">document.write("<script src=\"/inc/comment.jsp?channel=news&infoId=5948\"><\/script>");</script></td></tr></table><table width="577" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="#C4C4C4"><img src="/images/x.gif" width="1" height="1"></td></tr></table><table width="577" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="20" rowspan="7">&nbsp;</td><td height="30" class="t_font">相关文章:</td></tr><tr><td colspan="2" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top"><script language="JavaScript">document.write("<script src=\"/inc/relation.jsp?newskeys=VB,编程,游戏&id=5948\"><\/script>");</script></table></td></tr><tr><td colspan="2">&nbsp;</td></tr></table></td><td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="20" rowspan="7">&nbsp;</td><td height="30" class="t_font">相关软件:</td></tr><tr><td colspan="2" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top"><script language="JavaScript">document.write("<script src=\"/inc/relation_soft.jsp?softkeys=VB,编程,游戏&id=5948\"><\/script>");</script></table></td></tr><tr><td colspan="2">&nbsp;</td></tr></table></td></tr></table></td><td width="1" valign="top" bgcolor="#C4C4C4"><img src="/images/x.gif" width="1" height="1"></td></tr></table><table width="770" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#C4C4C4"><tr><td width="770" height="1"><img src="/images/x.gif" width="1" height="1"></td></tr></table><table width="770" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td><img src="/images/last2.gif" width="770" height="18"></td></tr></table><Script language="JavaScript" src="/foot.js"> // </Script></body></html>

⌨️ 快捷键说明

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