私はモバイルゲームを構築していて、Flappy bird と同じ画像回転の概念を実装しようとしています。
画像カウンターの時計を重力で回転させることができ、画面に触れると時計回りに回転します
私の問題は、画面に触れて鳥を飛ばすときに時計回りにスムーズに回転しないことです。鳥が船のように揺れているように見えます。私はそれが起源に関係していることを知っていますが、私はここで立ち往生しています.
私のコードを見る
private void updateAnimation(){
stateTime += Gdx.graphics.getDeltaTime();
if(!Play.hit && Play.state != Play.GAME_OVER)
currentFrame = walkAnimation.getKeyFrame(stateTime, true);
anim = new Sprite(currentFrame);
anim.setSize(BODY_WIDTH, BODY_HEIGHT);
anim.setOrigin(BODY_WIDTH/2, BODY_HEIGHT/2);
anim.setPosition(SCREEN_X-BODY_WIDTH/2, Player.position.y);
if(Play.state == Play.GAME_RUNNING ){
if(ANGLE >= -75){
if(!Gdx.input.justTouched()){
updateRotation();
}
}
anim.setRotation(getANGLE());
}
anim.draw(batch);
}
public void updateRotation(){
ANGLE = Player.velocity.y / 8;
}
これは、時計回りの回転を設定するためのコードです
if(GameWorld.ANGLE <= 10){
GameWorld.setANGLE(5* Gdx.graphics.getDeltaTime());
}
Player.velocity.y = 320;