0
私のアニメーションに多くのテクスチャをロードすると、ゲームのわずかな遅れが発生し、テクスチャアトラクションの配列テクスチャが必要になると思います。以下のコードは私のアニメーションコードです。また、アニメーションのテクスチャフレームインデックスを取得し、テクスチャインデックスが表示されている場合にはタスクを実行します。すでに、texture.atlasのshot.packという名前の.packファイルがありますが、どのようにそれを適用し、これのようにするか分からなかった。私は誰かがテクスチャアトラスとアニメーションのテクスチャ
Texture[] shot;
//At CONSTRUCTOR
shot = new Texture[21];
for(int i=0; i <21; i++){
if(i == 19 || i==20){
shot[i]=new Texture("s18.png");
}
else {
shot[i] = new Texture("s" + Integer.toString(i) + ".png");
}
}
//animation
animation = new Animation(1/19f,shot);
//@render METHOD
sb.draw((Texture) animation.getKeyFrame(timePassed, false), ShootingTreys.WIDTH * 0.03f, ShootingTreys.HEIGHT * 0.03f, (ShootingTreys.WIDTH * 1/6), (ShootingTreys.HEIGHT/2) + (ShootingTreys.HEIGHT * 0.13f));
if (animation.getKeyFrameIndex(timePassed) == 20) {
isShotDelay = true;
shotDelay += Gdx.graphics.getDeltaTime();
if (shotDelay >= 0.2f || ball.getBall().getY() < ShootingTreys.HEIGHT * 0.2f) {
touch = false;
timePassed = 0;
shotDelay = 0;
isShotDelay = true;
//for missed ball
colide = false;
}
}
アニメーションが完了したら、1つのフレームを表示するにはどうすればよいですか? –
テクスチャパッカー内のテクスチャが順番に並んでいません –
アニメーションのレンダリングに条件を設定し、その条件に単一フレームを表示します。 – Aryan