Can someone help me define these 3 lines of code?

时间:2016-02-03 04:13:52

标签: libgdx

Can somebody help me with what these lines of code are actually saying?

 if (!(x == snakeX && y == snakeY)) batch.draw(texture, x, y);

and

 for (BodyPart bodyPart : bodyParts) {
        bodyPart.draw(batch);
    }

1 个答案:

答案 0 :(得分:2)

这是你可以说的那些行

 if (!(x == snakeX && y == snakeY)) batch.draw(texture, x, y);
  

如果某个坐标*(x,y)不等于蛇坐标   (蛇在屏幕中的位置)然后将绘制纹理   屏幕(x,y)位置的屏幕

 for (BodyPart bodyPart : bodyParts) {
        bodyPart.draw(batch);
    }
  

绘制每个标准类的蛇体的所有部分   名为BodyPart

这段代码指的是蛇的经典游戏

祝你好运