坦克大战碰撞为什么坦克老是黏在一起,代码如下

// 判断敌人是否碰撞 /** * @return */ public boolean enemyCollide() { boolean b = false; switch (this.direct) { // 坦克向上的时候 case 0: for (int i = 0; i < enemy.size(); i++) { Enemy ey = enemy.get(i); if (ey != this) { //this坦克向上,第二个坦克向上或向下的时候 if (ey.direct == 0 || ey.direct == 2) { //左上角一点 if (this.x >ey.x && this.x < ey.x +20&& this.y > ey.y && this.y ey.x && this.x +20< ey.x +20&& this.y > ey.y && this.y ey.x && this.x < ey.x +30&& this.y > ey.y && this.y ey.x && this.x +20< ey.x +30&& this.y > ey.y && this.y ey.x && this.x+30 < ey.x +20&& this.y > ey.y && this.y ey.x && this.x +30< ey.x +20&& this.y+20 > ey.y && this.y+20 ey.x && this.x+30 < ey.x +30&& this.y > ey.y && this.y ey.x && this.x +30< ey.x +30&& this.y+20 > ey.y && this.y+30 ey.x && this.x +30< ey.x +30&& this.y+30 > ey.y && this.y+30 ey.x && this.x +20< ey.x +20&& this.y+30 > ey.y && this.y+30 ey.x && this.x < ey.x +30&& this.y+30 > ey.y && this.y+30 ey.x && this.x +20< ey.x +30&& this.y+30 > ey.y && this.y+30 ey.x && this.x < ey.x +20&& this.y > ey.y && this.y ey.x && this.x < ey.x +20&& this.y+20 > ey.y && this.y +20ey.x && this.x < ey.x +30&& this.y > ey.y && this.y ey.x && this.x < ey.x +30&& this.y+20 > ey.y && this.y+20

把代码格式化一下,这样看不懂代码?

代码请用代码段标签

您好,我是有问必答小助手,你的问题已经有小伙伴为您解答了问题,您看下是否解决了您的问题,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632

非常感谢您使用有问必答服务,为了后续更快速的帮您解决问题,现诚邀您参与有问必答体验反馈。您的建议将会运用到我们的产品优化中,希望能得到您的支持与协助!

速戳参与调研>>>https://t.csdnimg.cn/Kf0y