我正在尝试渲染精灵'chicken chciekenImage',但是当我跑步时,图像无法看到,但我相信图像正在渲染但只是没有出现,因为它与另一个精灵重叠以提供输出,所以它只是没有显示。没有错误。
守则:
public void render(float delta) {
Iterator<Rectangle> iter = chickens.iterator();
...
while(iter.hasNext()){
Rectangle chicken = iter.next();
if(farmerX < (chicken.x - 85/2)) chicken.x -= 2.5;
if(farmerX > (chicken.x - 85/2))chicken.x += 2.5;
if (farmerY < (chicken.y - 66/2))chicken.y -= 2.5;
if(farmerY > (chicken.y - 66/2))chicken.y += 2.5;
float diffYchick;
float diffXchick;
float angleDegreeschick;
diffYchick = (float) (farmerY - chicken.y);
diffXchick = (float) (farmerX - chicken.x);
angleDegreeschick = (float) Math.toDegrees(Math.atan2(diffYchick, diffXchick));
game.batch.begin();
game.font.draw(game.batch, "Chickens Running: " + runningChickens, 0, 1080);
game.batch.draw(chickenImage, (float)chicken.x, (float)chicken.y, (float)42.5, (float)33, (float)85, (float)66, (float)1, (float)1, (float)angleDegreeschick);
game.batch.end();
camera.update();
inputUpdate(touch, camera);
batch.setProjectionMatrix(camera.combined);
...
}
}