?? gamelogic.java~1~
字號:
{ //////在暴炸點上
M_Bomb[i][3] = 1; //////設置下一次暴.
}
}
}
}
/* for (k = 0; k < M_detonation_spot.length; k++)
{
if (M_detonation_spot[k][0] == 0)
break;
for (i = 0; i < m_bombtotal; i++)
{
if (M_detonation_spot[k][0] >= 1 && M_detonation_spot[k][0] <= 7 &&
M_detonation_spot[k][1] == M_Bomb[i][1] &&
M_detonation_spot[k][2] == M_Bomb[i][2])
{ //////在暴炸點上
M_Bomb[i][3] = 1; //////設置下一次暴.
}
}
} */
}
private void Disposaldetonation_spot(Graphics g) { /////////////處理暴炸點.-1
int k = 0;
for (; k < M_detonation_spot.length; k++)
{
if (M_detonation_spot[k][0] != 0)
{
M_detonation_spot[k][3]--;
if ( M_detonation_spot[k][0] > 7 )
g.drawImage(M_imgmedal[M_detonation_spot[k][0]-20], (M_detonation_spot[k][1] << 4) - m_movex,
(M_detonation_spot[k][2] << 4) - m_movey, 0);
else
g.drawImage(m_Bombing[M_detonation_spot[k][0]-1], (M_detonation_spot[k][1] << 4) - m_movex,
(M_detonation_spot[k][2] << 4) - m_movey, 0);
if (M_detonation_spot[k][3] == 0)
{
M_detonation_spot[k][0] = 0;
}
}
}
}
private void DisposalCPUplay() { //////////////////////////處理CPU玩家.沒有處理特殊小怪.(穿插墻,放蛋可在這處理)
for (int icpu = 0; icpu < m_iCPUPlayNo; icpu++) //cpu個數要改過來
{ // 測試用
if (M_iCPlay[icpu][0] > 0)
{
int x, y, i, j = 0, k, rr[] =
{
0, 0, 0, 0};
x = M_iCPlay[icpu][1];
y = M_iCPlay[icpu][2];
i = M_iCPlay[icpu][3];
// m_pathW=16-M_iCPlay[icpu][5]; // 修改行走
m_pathW = 16 - 4;
/////////////////////////////////原方向先做.
if (i == 0)
{ //<<----------
x = x - M_iCPlay[icpu][5];
if (M_imapno[ (y) >>4][ (x + 1) >>4] == 1 &&
M_imapno[ (y + 16) >>4][ (x + 1) >>4] == 1)
{ // 修改
M_iCPlay[icpu][1] = x;
M_iCPlay[icpu][2] = y;
rr[0] = 1;
}
else if (M_imapno[ (y + M_iCPlay[icpu][5]) >>4][x >>4] == 1 &&
M_imapno[ (y + m_pathW) >>4][x >>4] == 1)
{ //修改
M_iCPlay[icpu][1] = x;
if ((y &0xf) <= 5)
{
k = 0;
}
else
{
k = 16;
}
M_iCPlay[icpu][2] = ( (y >> 4) << 4) + k;
rr[0] = 1;
}
i = 0;
}
else if (i == 1)
{ // up
y = y - M_iCPlay[icpu][5];
if (M_imapno[y >>4][ (x) >>4] == 1 &&
M_imapno[y >>4][ (x + 16) >>4] == 1)
{
M_iCPlay[icpu][1] = x;
M_iCPlay[icpu][2] = y;
rr[1] = 1;
}
else if (M_imapno[y >>4][ (x + M_iCPlay[icpu][5]) >>4] == 1 &&
M_imapno[y >>4][ (x + m_pathW) >>4] == 1)
{ //修改
if ((x &0xf) <= 5)
{
k = 0;
}
else
{
k = 16;
}
M_iCPlay[icpu][1] = ( (x >> 4) << 4) + k;
M_iCPlay[icpu][2] = y;
rr[1] = 1;
}
i = 1;
}
else if (i == 2)
{ ///---->
x = x + M_iCPlay[icpu][5];
if (M_imapno[ (y) >>4][ (x + m_pathW) >>4] == 1 &&
M_imapno[ (y + 16) >>4][ (x + m_pathW) >>4] == 1)
{
M_iCPlay[icpu][1] = x;
M_iCPlay[icpu][2] = y;
rr[2] = 1;
}
else if (M_imapno[ (y + M_iCPlay[icpu][5]) >>4][ (x + m_pathW) >>4] ==
1 && M_imapno[ (y + m_pathW) >>4][ (x + m_pathW) >>4] == 1)
{
if ((y &0xf) <= 5)
{
k = 0;
}
else
{
k = 16;
}
M_iCPlay[icpu][1] = x;
M_iCPlay[icpu][2] = ( (y >> 4) << 4) + k;
rr[2] = 1;
}
i = 2;
}
else if (i == 3)
{ ////down
y = y + M_iCPlay[icpu][5];
if (M_imapno[ (y + m_pathW) >>4][ (x) >>4] == 1 &&
M_imapno[ (y + m_pathW) >>4][ (x + 16) >>4] == 1)
{
M_iCPlay[icpu][1] = x;
M_iCPlay[icpu][2] = y;
rr[3] = 1;
}
else if (M_imapno[ (y + m_pathW) >>4][ (x + M_iCPlay[icpu][5]) >>4] ==
1 && M_imapno[ (y + m_pathW) >>4][ (x + m_pathW) >>4] == 1)
{
if ((x &0xf) <= 5)
{
k = 0;
}
else
{
k = 16;
}
M_iCPlay[icpu][1] = ( (x >> 4) << 4) + k;
M_iCPlay[icpu][2] = y;
rr[3] = 1;
}
i = 3;
}
if (rr[0] == 1 || rr[1] == 1 || rr[2] == 1 || rr[3] == 1)
{
M_iCPlay[icpu][3] = i;
M_iCPlay[icpu][4] = (M_iCPlay[icpu][4] +1) &0x1;
}
else
{
int iii = 0;
while (rr[0] == 0 && iii < 6)
{ ///////////////最多選5次,當能你可以改
x = M_iCPlay[icpu][1];
y = M_iCPlay[icpu][2];
i = rand_no(4);
iii++;
/* if (i == 0)
{
i = 2;
}
else if (i == 1)
{
i = 4;
}
else if (i == 2)
{
i = 6;
}
else
{
i = 8;
} */
if (i == 0)
{ //<<----------
x = x - M_iCPlay[icpu][5];
if (M_imapno[ (y) >>4][ (x + 1) >>4] == 1 &&
M_imapno[ (y + 16) >>4][ (x + 1) >>4] == 1)
{ // 修改
M_iCPlay[icpu][1] = x;
M_iCPlay[icpu][2] = y;
rr[0] = 1;
}
else if (M_imapno[ (y + M_iCPlay[icpu][5]) >>4][x >>4] == 1 &&
M_imapno[ (y + m_pathW) >>4][x >>4] == 1)
{ //修改
M_iCPlay[icpu][1] = x;
if ( (y &0xf ) <= 5)
{
k = 0;
}
else
{
k = 16;
}
M_iCPlay[icpu][2] = ( (y >> 4) << 4) + k;
rr[0] = 1;
}
i = 0;
}
else if (i == 1)
{ // up
y = y - M_iCPlay[icpu][5];
if (M_imapno[y >>4][ (x) >>4] == 1 &&
M_imapno[y >>4][ (x + 16) >>4] == 1)
{
M_iCPlay[icpu][1] = x;
M_iCPlay[icpu][2] = y;
rr[0] = 1;
}
else if (M_imapno[y >>4][ (x + M_iCPlay[icpu][5]) >>4] == 1 &&
M_imapno[y >>4][ (x + m_pathW) >>4] == 1)
{ //修改
if ( (x &0xf) <= 5)
{
k = 0;
}
else
{
k = 16;
}
M_iCPlay[icpu][1] = ( (x >> 4) << 4) + k;
M_iCPlay[icpu][2] = y;
rr[0] = 1;
}
i = 1;
}
else if (i == 2)
{ ///---->
x = x + M_iCPlay[icpu][5];
if (M_imapno[ (y) >>4][ (x + m_pathW) >>4] == 1 &&
M_imapno[ (y + 16) >>4][ (x + m_pathW) >>4] == 1)
{
M_iCPlay[icpu][1] = x;
M_iCPlay[icpu][2] = y;
rr[0] = 1;
}
else if (M_imapno[ (y + M_iCPlay[icpu][5]) >>4][ (x + m_pathW) >>4
] == 1 &&
M_imapno[ (y + m_pathW) >>4][ (x + m_pathW) >>4] == 1)
{
if ( (y &0xf) <= 5)
{
k = 0;
}
else
{
k = 16;
}
M_iCPlay[icpu][1] = x;
M_iCPlay[icpu][2] = ( (y >> 4) << 4) + k;
rr[0] = 1;
}
i = 2;
}
else if (i == 3)
{ ////down
y = y + M_iCPlay[icpu][5];
if (M_imapno[ (y + m_pathW) >>4][ (x) >>4] == 1 &&
M_imapno[ (y + m_pathW) >>4][ (x + 16) >>4] == 1)
{
M_iCPlay[icpu][1] = x;
M_iCPlay[icpu][2] = y;
rr[0] = 1;
}
else if (M_imapno[ (y + m_pathW) >>4][ (x + M_iCPlay[icpu][5]) /
16] == 1 &&
M_imapno[ (y + m_pathW) >>4][ (x + m_pathW) >>4] == 1)
{
if ((x &0xf) <= 5)
{
k = 0;
}
else
{
k = 16;
}
M_iCPlay[icpu][1] = ( (x >> 4) << 4) + k;
M_iCPlay[icpu][2] = y;
rr[0] = 1;
}
i = 3;
}
if (rr[0] == 1)
M_iCPlay[icpu][3] = i;
M_iCPlay[icpu][4] = 0;
}
}
}
}
}
}
private void DisposalHplay() { //////////////////處理人玩家
int x, y, i, j = 0, k, kk;
x = M_iHPlay[1];
y = M_iHPlay[2];
i = M_iHPlay[3];
if (m_iKey == KEY_FIRE)
{ //////////////處理放蛋 5 is keycode
k = x >> 4; // k and kk is bomb position
if ( (x &0xf) >= 8)
{
k = k + 1;
}
kk = y >> 4;
if ( (y &0xf) >= 8)
{
kk = kk + 1;
}
if (M_imapno[kk][k] != 3)
{ // ???
for (i = 0; i < m_bombtotal; i++)
{
if (M_Bomb[i][0] == 1)
{
j++; // 統計炸彈個數
}
}
if (j < M_iHPlay[6])
{
for (i = 0; i < m_bombtotal; i++)
{
if (M_Bomb[i][0] == 0)
{
M_imapno[kk][k] = 3;
M_Bomb[i][0] = 1;
M_Bomb[i][1] = (byte) k;
M_iHPlay[1] = (M_Bomb[i][1] * 16);
M_Bomb[i][2] = (byte) kk;
M_iHPlay[2] = (M_Bomb[i][2] * 16);
M_Bomb[i][3] = bombset; // bomb live time
M_Bomb[i][4] = (byte) (M_iHPlay[4]);
break;
}
}
}
}
}
else
{ ///////////////////////////////////處理行走
oldmandirect = (byte) M_iHPlay[3];
// m_pathW=16-M_iHPlay[5]; //修改行走
m_pathW = 16 - M_iHPlay[5];
if (m_iKey == KEY_LEFT)
{ //<<----------
x = x - M_iHPlay[5];
if (M_imapno[ (y) >>4][ (x + 1) >>4] == 1 &&
M_imapno[ (y + 16) >>4][ (x + 1) >>4] == 1)
{
M_iHPlay[1] = x;
M_iHPlay[2] = y;
}
else if (M_imapno[ (y + M_iHPlay[5]+2) / 16][x / 16] == 1 &&
M_imapno[ (y + m_pathW-2) / 16][x / 16] == 1)
{
M_iHPlay[1] = x;
if ((y &0xf) <= 5)
{
k = 0;
}
else
{
k = 16;
}
M_iHPlay[2] = ( (y >> 4) << 4) + k;
}
i = 0;
}
else if (m_iKey == KEY_UP)
{ ////// up
y = y - M_iHPlay[5];
if (M_imapno[y >>4][ (x) >>4] == 1 &&
M_imapno[y >>4][ (x + 16) >>4] == 1)
{
M_iHPlay[1] = x;
M_iHPlay[2] = y;
}
else if (M_imapno[ (y) >>4][ (x + M_iHPlay[5]+2) >>4] == 1 &&
M_imapno[ (y) >> 4][ (x + m_pathW-2) >>4] == 1)
{ //修改
if ((x &0xf) <= 5)
{
k = 0;
}
else
{
k = 16;
}
M_iHPlay[1] = ( (x >> 4) << 4) + k;
M_iHPlay[2] = y;
}
i = 1;
}
else if (m_iKey == KEY_RIGHT)
{ ///---->
x = x + M_iHPlay[5];
if( M_imapno[ y >>4][ x>>4] == 3)
{
M_iHPlay[1] = x;
M_iHPlay[2] = y;
}
if (M_imapno[ (y) >>4][ (x + m_pathW) >>4] == 1 &&
M_imapno[ (y + 16) >>4][ (x + m_pathW) >>4] ==1 )
{
M_iHPlay[1] = x;
M_iHPlay[2] = y;
}
else if (M_imapno[ (y + M_iHPlay[5]+2) >>4][ (x + m_pathW) >>4] == 1 &&
M_imapno[ (y + m_pathW-2) >>4][ (x + m_pathW) >>4] == 1)
{
if ((y &0xf) <= 5)
{
k = 0;
}
else
{
k = 16;
}
M_iHPlay[1] = x;
M_iHPlay[2] = ( (y >> 4) << 4) + k;
}
i = 2;
}
else if (m_iKey == KEY_DOWN)
{ ////// down
y = y + M_iHPlay[5];
if( M_imapno[ y >>4][ x>>4] == 3)
{
M_iHPlay[1] = x;
M_iHPlay[2] = y;
}
if (M_imapno[ (y + m_pathW) >>4][ (x) >>4] == 1 &&
M_imapno[ (y + m_pathW) >>4][ (x + 16) >>4] == 1)
{
M_iHPlay[1] = x;
M_iHPlay[2] = y;
}
else if (M_imapno[ (y + m_pathW) >>4][ (x + M_iHPlay[5]+2) >>4] == 1 &&
M_imapno[ (y + m_pathW) >>4][ (x + m_pathW-2) >>4] == 1)
{
if ((x &0xf) <= 5)
{
k = 0;
}
else
{
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -