📄 bullet.java
字号:
i <= ( (collY + frameHeight - 1) / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW + 1); i += (SuperTank.canvas.mapWidth / tileW)) { if (SuperTank.canvas.mapInfo[i] == 3) { grassPaint = true; } if (SuperTank.canvas.mapInfo[i] != 0 && SuperTank.canvas.mapInfo[i] != 3) { collFlag = true; break; } } }*/ } } break; case 2: //right collX = collX + frameWidth + tileW; BposX = posX - bombImage.getWidth() / 2; BposY = posY - bombImage.getHeight() / 2; if (collX - tileW + speed>= (SuperTank.canvas.mapWidth)) { collFlag = true; mapBlock = 0x0ffff; BposX = SuperTank.canvas.mapOffsetX + SuperTank.canvas.mapWidth - bombImage.getWidth(); posX = SuperTank.canvas.mapOffsetX + SuperTank.canvas.mapWidth - frameWidth; break; } else { collFlag = false; mapBlock = (collY / tileW - 1) * (SuperTank.canvas.mapWidth / tileW) + collX / tileW; for (i = (collY / tileW - 1) * (SuperTank.canvas.mapWidth / tileW) + collX / tileW; i <= ( (collY + frameHeight - 1) / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW + 1); i += (SuperTank.canvas.mapWidth / tileW)) { if (SuperTank.canvas.mapInfo[i] == 3) { grassPaint = true; } if (SuperTank.canvas.mapInfo[i] != 0 && SuperTank.canvas.mapInfo[i] != 3) { collFlag = true; isContinue1 = false; break; } } if(starNum != 0 && speed > tileW && isContinue1){ collX = collX + tileW; mapBlock = (collY / tileW - 1) * (SuperTank.canvas.mapWidth / tileW) + collX / tileW; for (i = (collY / tileW - 1) * (SuperTank.canvas.mapWidth / tileW) + collX / tileW; i <= ( (collY + frameHeight - 1) / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW + 1); i += (SuperTank.canvas.mapWidth / tileW)) { if (SuperTank.canvas.mapInfo[i] == 3) { grassPaint = true; } if (SuperTank.canvas.mapInfo[i] != 0 && SuperTank.canvas.mapInfo[i] != 3) { collFlag = true; // isContinue2 = false; break; } } /* if(starNum == 2 && (speed - tileW) >= tileW && isContinue2){ collX = collX + tileW; mapBlock = (collY / tileW - 1) * (SuperTank.canvas.mapWidth / tileW) + collX / tileW; for (i = (collY / tileW - 1) * (SuperTank.canvas.mapWidth / tileW) + collX / tileW; i <= ( (collY + frameHeight - 1) / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW + 1); i += (SuperTank.canvas.mapWidth / tileW)) { if (SuperTank.canvas.mapInfo[i] == 3) { grassPaint = true; } if (SuperTank.canvas.mapInfo[i] != 0 && SuperTank.canvas.mapInfo[i] != 3) { collFlag = true; break; } } }*/ } } break; case 3: //up collY = collY - tileW; BposX = posX - bombImage.getWidth() / 2; BposY = posY - bombImage.getHeight() / 2; if (collY + tileW <= speed) { collFlag = true; mapBlock = 0x0ffff; BposY = SuperTank.canvas.mapOffsetY; posY = SuperTank.canvas.mapOffsetY; break; } else { collFlag = false; mapBlock = collY / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW -1; for (i = collY / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW - 1; i <= collY / tileW * (SuperTank.canvas.mapWidth / tileW) + (collX + frameWidth - 1) / tileW; i++) { //setup to repaint the grass if (SuperTank.canvas.mapInfo[i] == 3) { grassPaint = true; } if (SuperTank.canvas.mapInfo[i] != 0 && SuperTank.canvas.mapInfo[i] != 3) { collFlag = true; isContinue1 = false; break; } } if(starNum != 0 && speed > tileW && isContinue1){ collY = collY - tileW; mapBlock = collY / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW - 1; for (i = collY / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW - 1; i <= collY / tileW * (SuperTank.canvas.mapWidth / tileW) + (collX + frameWidth - 1) / tileW; i++) { //setup to repaint the grass if (SuperTank.canvas.mapInfo[i] == 3) { grassPaint = true; } if (SuperTank.canvas.mapInfo[i] != 0 && SuperTank.canvas.mapInfo[i] != 3) { collFlag = true; // isContinue2 = false; break; } } /* if(starNum == 2 && (speed - tileW) >= tileW && isContinue2){ collY = collY - tileW; mapBlock = collY / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW - 1; for (i = collY / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW - 1; i <= collY / tileW * (SuperTank.canvas.mapWidth / tileW) + (collX + frameWidth - 1) / tileW; i++) { //setup to repaint the grass if (SuperTank.canvas.mapInfo[i] == 3) { grassPaint = true; } if (SuperTank.canvas.mapInfo[i] != 0 && SuperTank.canvas.mapInfo[i] != 3) { collFlag = true; break; } } }*/ } } break; case 4: //down collY = collY + frameHeight; BposX = posX - bombImage.getWidth() / 2; BposY = posY - bombImage.getHeight() / 2; if (collY >= (SuperTank.canvas.mapHeight - speed)) { collFlag = true; mapBlock = 0x0ffff; BposY = SuperTank.canvas.mapOffsetY + SuperTank.canvas.mapHeight - bombImage.getHeight(); posY = SuperTank.canvas.mapOffsetY + SuperTank.canvas.mapHeight - frameHeight; break; } else { collFlag = false; mapBlock = collY / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW - 1; for (i = collY / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW - 1; i <= collY / tileW * (SuperTank.canvas.mapWidth / tileW) + (collX + frameWidth - 1) / tileW; i++) { //setup to repaint the grass if (SuperTank.canvas.mapInfo[i] == 3) { grassPaint = true; } if (SuperTank.canvas.mapInfo[i] != 0 && SuperTank.canvas.mapInfo[i] != 3) { collFlag = true; isContinue1 = false; break; } } if(starNum != 0 && speed > tileW && isContinue1){ collY = collY + tileW; mapBlock = collY / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW - 1; for (i = collY / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW - 1; i <= collY / tileW * (SuperTank.canvas.mapWidth / tileW) + (collX + frameWidth - 1) / tileW; i++) { //setup to repaint the grass if (SuperTank.canvas.mapInfo[i] == 3) { grassPaint = true; } if (SuperTank.canvas.mapInfo[i] != 0 && SuperTank.canvas.mapInfo[i] != 3) { collFlag = true; // isContinue2 = false; break; } } /* if(starNum == 2 && (speed - tileW) >= tileW && isContinue2){ collY = collY + tileW; mapBlock = collY / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW - 1; for (i = collY / tileW * (SuperTank.canvas.mapWidth / tileW) + collX / tileW - 1; i <= collY / tileW * (SuperTank.canvas.mapWidth / tileW) + (collX + frameWidth - 1) / tileW; i++) { //setup to repaint the grass if (SuperTank.canvas.mapInfo[i] == 3) { grassPaint = true; } if (SuperTank.canvas.mapInfo[i] != 0 && SuperTank.canvas.mapInfo[i] != 3) { collFlag = true; break; } } }*/ } } break; default: break; } return collFlag; } boolean isobjCollide( int objX, int objY, int width, int height ) { boolean collFlag = false; int i; if ( posX < (objX + width) && (posX + frameWidth) > objX && posY < (objY + width) && (posY + frameHeight) > objY ) collFlag = true; return collFlag; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -