📄 gamescreen.java
字号:
magicx += magicspeedx;
if(mcount < 1)
mdir *= -1;
mcount += mdir;
tx = ((magicspeedy * (mcount * mcount)) / 2) * mdir;
magicy += tx <= 15 ? tx : 15;
byte byte0 = ((byte)(magicspeedx <= 0 ? 2 : 3));
if(magicx < 0 || magicx > Harry.SW || magicy < 0 || magicy > Harry.SH)
magicalive = false;
else
if(isBlocked(magicx - 5, magicy - 5, magicx + 5, magicy + 5, byte0))
{
magicalive = false;
setEffect(2, magicx, magicy);
}
if(magicspeedx == 0)
{
lumos--;
if(lumos < 0)
{
magicalive = false;
for(int l = 0; l < objinfo.length; l++)
{
if(objinfo[l][1] == 1 && objinfo[l][0] == 13)
{
if(objinfo[l][4] != 1)
continue;
objinfo[l][4] = 2;
objinfo[l][2]--;
objpos[l][1] -= 17;
rock = 5;
rm.play(11, false);
break;
}
if(objinfo[l][1] != 1 || objinfo[l][0] != 17)
continue;
objinfo[l][1] = 0;
rock = 5;
tx = objpos[l][0] / 16;
ty = objpos[l][1] / 16;
tileset[tx][ty] = 4;
Graphics g = gc.offimg.getGraphics();
drawImage(g, rm.getBg(stage, 1, tileset[tx][ty] / 6), rm.getImageCoord(tileset[tx][ty] % 6, 16, 16), tx * 16, ty * 16);
rm.play(11, false);
break;
}
}
}
}
}
public void die(int l)
{
if(hdie > 0)
return;
hlife--;
hdie = 20;
hstatus = 6;
setHarryAnim(hstatus);
hxspeed = 0;
if(l == 0)
{
hx = prehx;
hy = prehy;
} else
if(l != 1);
if(hlife < 0)
{
g_status = 4;
hxspeed = 0;
hyspeed = -3;
prehx = 10;
rm.play(3, true);
} else
{
rm.play(7, false);
}
rm.setVib(1000);
actioncount = 0;
gc.setHighscore(score);
}
public void collision()
{
hobjon = false;
cx = magicx - 10;
cy = magicy - 7;
tbool = true;
if(hdie > 0 || stun_time > 0 || musuk_time > 0)
tbool = false;
for(int l = 0; l < moninfo.length; l++)
{
if(moninfo[l][1] != 1)
continue;
if(stun_time < 1)
controlMon(moninfo[l], monpos[l]);
if(magicalive && magictype != 2 && _HitCheck(cx, cy, cx + 20, cy + 10, monpos[l][0] - monpos[l][2], monpos[l][1] - monpos[l][3], monpos[l][0] + monpos[l][2], monpos[l][1]))
{
if(magictype == 4)
{
if(moninfo[l][0] == 5)
moninfo[l][3] -= 2;
else
moninfo[l][3]--;
magicalive = false;
if(moninfo[l][3] < 1)
{
moninfo[l][1] = 0;
rm.play(5, false);
} else
{
rm.play(6, false);
}
setEffect(3, monpos[l][0], monpos[l][1] - 5);
} else
if(magictype == 0)
{
moninfo[l][8] = 0;
if(moninfo[l][0] != 5)
moninfo[l][3] -= 2;
if(moninfo[l][3] < 1)
{
moninfo[l][1] = 0;
rm.play(5, false);
} else
{
rm.play(6, false);
}
magicalive = false;
setEffect(1, monpos[l][0], monpos[l][1] - 5);
} else
if(magictype == 1)
{
moninfo[l][9] = 1;
if(moveObj(monpos[l]))
break;
} else
if(magictype == 3)
{
magicalive = false;
if(moninfo[l][0] != 5)
{
changeMon(monpos[l][0], monpos[l][1], magicspeedx <= 0 ? 1 : -1);
rm.play(8, false);
moninfo[l][1] = 0;
setEffect(1, monpos[l][0], monpos[l][1] - 5);
}
}
if(!magicalive)
{
if(moninfo[l][1] == 0)
{
addExp(monbasic[moninfo[l][0]][5]);
if(moninfo[l][0] == 6)
{
score += monbasic[moninfo[l][0]][4] * 10;
byte abyte0[][] = rm.getMapData(mapid, (byte)3);
for(int k1 = 0; k1 < abyte0.length; k1++)
{
if(abyte0[k1][0] != 6)
continue;
abyte0[k1][1] = 0;
break;
}
} else
{
score += monbasic[moninfo[l][0]][4];
if(getPercent(monbasic[moninfo[l][0]][3]))
popObj((byte)0, monpos[l][0], (monpos[l][1] / 16) * 16, magicspeedx <= 0 ? 1 : -1);
if(moninfo[l][0] == 10)
{
popMon((byte)3, monpos[l][0], monpos[l][1] - 15);
popMon((byte)3, monpos[l][0], monpos[l][1] + 5);
}
}
}
break;
}
}
if(!tbool || moninfo[l][1] != 1 || !_HitCheck(hcbox[0][0], hcbox[0][1], hcbox[1][0], hcbox[1][1], monpos[l][0] - monpos[l][2], monpos[l][1] - monpos[l][3], monpos[l][0] + monpos[l][2], monpos[l][1]))
continue;
if(moninfo[l][0] == 6)
{
if(hSlot[1] >= 10)
continue;
hSlot[1]++;
setGetinfo(4);
moninfo[l][1] = 0;
byte abyte1[][] = rm.getMapData(mapid, (byte)3);
for(int l1 = 0; l1 < abyte1.length; l1++)
{
if(abyte1[l1][0] != 6)
continue;
abyte1[l1][1] = 0;
break;
}
break;
}
hx = calPos(hx, hy - 2, 6, cx <= monpos[l][0] ? -12 : 12);
if(moninfo[l][0] == 8)
moninfo[l][1] = 0;
hdir = ((byte)(cx <= monpos[l][0] ? 3 : 2));
hjumpidx = -1;
hxspeed = 0;
updateHarryAnim();
die(1);
}
if(bosson)
{
if(magicalive && _HitCheck(cx, cy, cx + 20, cy + 10, bossx + 5, bossy - 35, bossx + 15, bossy - 15))
{
magicalive = false;
bosshitcount = 3;
if(magictype == 0)
{
bosshp -= 2;
setEffect(1, magicx, magicy);
} else
if(magictype == 4)
{
if(bosstype == 3)
bosshp -= 5;
setEffect(3, magicx, magicy);
} else
{
bosshp--;
setEffect(2, magicx, magicy);
}
}
if(hdie < 0 && musuk_time < 1 && _HitCheck(hcbox[0][0], hcbox[0][1], hcbox[1][0], hcbox[1][1], bossx + 5, bossy - 15, bossx + 15, bossy - 5))
{
hx = calPos(hx, hy - 2, 6, -12);
hjumpidx = -1;
hxspeed = 0;
updateHarryAnim();
die(1);
return;
}
}
if(magicalive)
{
for(int i1 = 0; i1 < objinfo.length; i1++)
if(objinfo[i1][1] == 1)
{
if(_HitCheck(cx, cy, cx + 20, cy + 10, objpos[i1][0], objpos[i1][1], objpos[i1][0] + 16, objpos[i1][1] + 16))
{
if(objinfo[i1][0] == 9 || objinfo[i1][0] == 7)
{
if(magictype == 0)
{
magicalive = false;
if(objinfo[i1][4] > 0)
{
objinfo[i1][4]--;
popObj((byte)0, objpos[i1][0], objpos[i1][1], magicspeedx <= 0 ? 1 : -1);
if(objinfo[i1][4] < 1)
objinfo[i1][1] = 0;
}
rm.play(9, false);
}
} else
if(objinfo[i1][0] == 8 && magictype == 0)
{
magicalive = false;
transObj(objpos[i1][0], objpos[i1][1], magicspeedx <= 0 ? 1 : -1);
objinfo[i1][1] = 0;
rm.play(10, false);
}
} else
if(objinfo[i1][0] == 6)
{
if(magictype == 1)
{
if(magicspeedx > 0)
{
if(getTilenum(objpos[i1][0] + 16, objpos[i1][1]) == -1 && objinfo[i1][3] == 0)
objinfo[i1][3] += 16;
} else
if(magicspeedx < 0 && getTilenum(objpos[i1][0] - 16, objpos[i1][1]) == -1 && objinfo[i1][3] == 0)
objinfo[i1][3] -= 16;
magicalive = false;
}
} else
if(objinfo[i1][0] == 10 && objinfo[i1][4] == 0)
magicalive = false;
if(objinfo[i1][1] == 0 && objinfo[i1][6] != -1)
{
byte abyte2[][] = rm.getMapData(scrinfo[mapID], (byte)2);
abyte2[objinfo[i1][6]][1] = 0;
}
}
}
cx = hcbox[0][0];
cy = hcbox[0][1];
for(int j1 = 0; j1 < objinfo.length; j1++)
if(objinfo[j1][1] == 1)
{
if(objinfo[j1][0] == 0 || objinfo[j1][0] == 3)
{
if(objinfo[j1][5] > -1)
if(objinfo[j1][5] < objhitpos[0].length)
{
objpos[j1][0] += objhitpos[0][objinfo[j1][5]] * objinfo[j1][3];
objpos[j1][1] += objhitpos[1][objinfo[j1][5]];
objinfo[j1][5]++;
} else
{
objinfo[j1][5] = -1;
}
} else
if(objinfo[j1][0] == 1)
{
objinfo[j1][5] = ((byte)(objinfo[j1][5] != -1 ? -1 : 1));
objpos[j1][1] += objinfo[j1][5];
} else
if(objinfo[j1][0] == 6)
if(objinfo[j1][3] > 0)
{
objinfo[j1][3] -= 4;
objpos[j1][0] += 4;
} else
if(objinfo[j1][3] < 0)
{
objinfo[j1][3] += 4;
objpos[j1][0] -= 4;
} else
if(getTilenum(objpos[j1][0], objpos[j1][1] + 16) == -1)
{
objpos[j1][1] += 4;
} else
{
for(int i2 = 0; i2 < objinfo.length; i2++)
if(objinfo[i2][1] == 1 && objinfo[i2][0] == 2 && objpos[i2][0] == objpos[j1][0] && objpos[i2][1] == objpos[j1][1] + 16)
{
objinfo[i2][1] = 0;
objinfo[j1][1] = 0;
tx = objpos[i2][0] / 16;
ty = objpos[i2][1] / 16;
tileset[tx][ty] = 4;
Graphics g = gc.offimg.getGraphics();
drawImage(g, rm.getBg(stage, 1, tileset[tx][ty] / 6), rm.getImageCoord(tileset[tx][ty] % 6, 16, 16), tx * 16, ty * 16);
byte abyte6[][] = rm.getMapData(scrinfo[mapID], (byte)1);
abyte6[objpos[i2][0] / 16 - mdx][objpos[i2][1] / 16 - mdy] = 1;
abyte6 = rm.getMapData(scrinfo[mapID], (byte)2);
abyte6[objinfo[i2][6]][1] = 0;
abyte6[objinfo[j1][6]][1] = 0;
setdoor(2);
score += 200;
}
}
if(_HitCheck(hcbox[0][0], hcbox[0][1], hcbox[1][0], hcbox[1][1], objpos[j1][0], objpos[j1][1], objpos[j1][0] + rm.objCoord[objinfo[j1][2]][2], objpos[j1][1] + rm.objCoord[objinfo[j1][2]][3]))
{
if(objinfo[j1][0] == 0)
{
objinfo[j1][1] = 0;
if(objinfo[j1][2] == 10)
beans++;
else
if(objinfo[j1][2] == 11)
beans += 3;
else
if(objinfo[j1][2] == 12)
beans += 5;
setGetinfo(0);
if(maxhlife % 100 == 0)
{
maxhlife += maxhlife / 100 - (maxhlife - 5);
hlife = maxhlife;
}
score += 20;
rm.play(10, false);
hitem = 2;
} else
if(objinfo[j1][0] == 1)
{
if(objinfo[j1][3] < 6 && hSlot[objinfo[j1][3] + 3] < 10)
{
hSlot[objinfo[j1][3] + 3]++;
objinfo[j1][1] = 0;
setGetinfo(1);
score += 100;
rm.play(10, false);
hitem = 2;
}
} else
if(objinfo[j1][0] == 3)
{
if(hSlot[2] < 10)
{
hSlot[2]++;
objinfo[j1][1] = 0;
setGetinfo(3);
score += 30;
rm.play(10, false);
hitem = 2;
}
} else
if(objinfo[j1][0] == 4)
{
if(puzzleon)
{
hobjon = true;
hobjidx = (byte)j1;
}
} else
if(objinfo[j1][0] == 5)
{
if(objinfo[j1][4] == 0)
{
hobjon = true;
hobjidx = (byte)j1;
}
} else
if(objinfo[j1][0] == 12)
{
if(objinfo[j1][4] == 0)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -