这可能看起来像一个非常简单的问题,但我很困惑。 我有一个if条件,它有很多条件,我无法弄清楚在这种情况下使用的括号语法。任何人都可以给我一些关于如何弄清楚这个或其他if语句中有多少条件的情况的正确语法的提示吗?谢谢!围绕每个条件处理括号的语法
void collisionEn() {
for (int i = 0; i < myPlats.length; i++) {
if (posEx > myPlats[i].xPos)
&& (posEx+wEx > myPlats[i].xPos)
&& (posEx+wEx < myPlats[i].xPos + myPlats[i].platWidth)
&& (posEx < myPlats[i].xPos + myPlats[i].platWidth)
&& (posEy > myPlats[i].yPos)
&& (posEy < myPlats[i].yPos + myPlats[i].platHeight)
&& (posEy+wEy > myPlats[i]yPos)
&& (posEy+wEy < myPlats[i].yPos + myPlats[i].platHeight)
rect(0, 0, 1000, 1000);
我不知道Processing处理支持你所建议的第二种语法。我想我可能误解了我正在阅读的这本书,我会再次检查它。另外,我犯的错误是:“&& posEy + wEy> myPlats [i] yPos”。我忘了在myPlats [i](。)yPos之后加上这个点。谢谢! – Alvarop 2013-04-22 12:05:16