骑士巡逻

骑士巡逻

还是没办法置入flash……

代码如下:

import flash.events.MouseEvent;

var Ma:Array=new Array([M11_mc,M12_mc,M13_mc,M14_mc,M15_mc,M16_mc,M17_mc,M18_mc],[M21_mc,M22_mc,M23_mc,M24_mc,M25_mc,M26_mc,M27_mc,M28_mc],[M31_mc,M32_mc,M33_mc,M34_mc,M35_mc,M36_mc,M37_mc,M38_mc],[M41_mc,M42_mc,M43_mc,M44_mc,M45_mc,M46_mc,M47_mc,M48_mc],[M51_mc,M52_mc,M53_mc,M54_mc,M55_mc,M56_mc,M57_mc,M58_mc],[M61_mc,M62_mc,M63_mc,M64_mc,M65_mc,M66_mc,M67_mc,M68_mc],[M71_mc,M72_mc,M73_mc,M74_mc,M75_mc,M76_mc,M77_mc,M78_mc],[M81_mc,M82_mc,M83_mc,M84_mc,M85_mc,M86_mc,M87_mc,M88_mc]);//定义棋子
var m,n;//位置
var t,k;//鼠标
var d=0;
var a,b;
var bool:Array=new Array();
for(n=0;n<=7;n++)
{
bool[n]=new Array();
for(m=0;m<=7;m++)
{
bool[n][m]=0;
}
}
stage.addEventListener(MouseEvent.MOUSE_DOWN,main);
function main(evt:MouseEvent):void{
t=mouseX;
k=mouseY;
if(t<=400&&t>=0&&k>=0&&t<=400)
{
n=(t-t%50)/50;
m=(k-k%50)/50;
if(d==0)
{
bool[n][m]=1;
d=Move(n,m);
}
else
{
Move(n,m);
}
d=1;
}
}
function Move(n:Number,m:Number):Number{
if(bool[n][m]==1)
{
Ma[m][n].gotoAndStop(2);
bool[n][m]=2;
for(t=0;t<=7;t++)
{
for(k=0;k<=7;k++)
{
if(bool[t][k]==1)
bool[t][k]=0;
}
}
b=m+2;
a=n+1;
if(a<=7&&b<=7)
{
bool[a][b]=1;
}
b=m+2;
a=n-1;
if(b<=7&&a>=0)
{
bool[a][b]=1;
}
a=m-2;
b=n+1;
if(a>=0&&b<=7) { bool[b][a]=1; } a=m-2; b=n-1; if(a>=0&&b>=0)
{
bool[b][a]=1;
}
a=m+1;
b=n+2;
if(a<=7&&b<=7)
{
bool[b][a]=1;
}
a=m+1;
b=n-2;
if(a<=7&&b>=0)
{
bool[b][a]=1;
}
a=m-1;
b=n+2;
if(a>=0&&b<=7) { bool[b][a]=1; } a=m-1; b=n-2; if(a>=0&&b>=0)
{
bool[b][a]=1;
}
}
return 1;
}
return_btn.addEventListener(MouseEvent.MOUSE_DOWN,replay);
function replay(evt:MouseEvent):void{
for(n=0;n<=7;n++)
{
for(m=0;m<=7;m++)
{
bool[n][m]=0;
Ma[n][m].gotoAndStop(1);
d=0;
}
}
}

10条评论

    1. Firefox 5.0.1 Firefox 5.0.1 Windows 7 x64 Edition Windows 7 x64 Edition
      Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0.1) Gecko/20100101 Firefox/5.0.1

      纯表被审核……

  1. Safari 4.0.5 Safari 4.0.5 iPod iOS 4.0 iPod iOS 4.0
    Mozilla/5.0 (iPod; U; CPU iPhone OS 4_0 like Mac OS X; zh-cn) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7

    我是来测试系统的

  2. Chromium 14.0.803.0 Chromium 14.0.803.0 Ubuntu 11.10 Ubuntu 11.10
    Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Ubuntu/11.10 Chromium/14.0.803.0 Chrome/14.0.803.0 Safari/535.1

    呃,刚注意到是骑士巡逻,一直看成了逻辑…… ➡

  3. Chromium 14.0.803.0 Chromium 14.0.803.0 Ubuntu 11.10 Ubuntu 11.10
    Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Ubuntu/11.10 Chromium/14.0.803.0 Chrome/14.0.803.0 Safari/535.1

    uc ……

    1. Chromium 14.0.803.0 Chromium 14.0.803.0 Ubuntu 11.10 Ubuntu 11.10
      Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Ubuntu/11.10 Chromium/14.0.803.0 Chrome/14.0.803.0 Safari/535.1

      就说i386也是显示686嘛

  4. UC Browser 7.8.1.96 UC Browser 7.8.1.96 GNU/Linux GNU/Linux
    JUC(Linux;U;2.1-update1;Zh_cn;U8110;240*320;)UCWEB7.8.1.96/139/999

    一直头疼flash播放器的问题……

    1. UC Browser 7.8.1.96 UC Browser 7.8.1.96 GNU/Linux GNU/Linux
      JUC(Linux;U;2.1-update1;Zh_cn;U8110;240*320;)UCWEB7.8.1.96/139/999

      考试期间,自娱自乐。 😀

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注