Libgdx 旋转精灵并反向旋转
我正在开发一款手机游戏,并试图实现与Flappy bird相同的图像旋转概念 我能够用重力旋转图像计数器时钟,当我触摸屏幕时,旋转是顺时针的Libgdx 旋转精灵并反向旋转,libgdx,game-engine,game-physics,flappy-bird-clone,Libgdx,Game Engine,Game Physics,Flappy Bird Clone,我正在开发一款手机游戏,并试图实现与Flappy bird相同的图像旋转概念 我能够用重力旋转图像计数器时钟,当我触摸屏幕时,旋转是顺时针的 if(GameWorld.ANGLE <= 10){ GameWorld.setANGLE(5* Gdx.graphics.getDeltaTime()); } Player.velocity.y = 320; 我的问题是,当我触摸屏幕让鸟儿飞翔时,我没有得到顺时针的平稳旋转。这只鸟看起来像船一样摇晃。 我知道这和起源有关,但我被困在这里了
if(GameWorld.ANGLE <= 10){
GameWorld.setANGLE(5* Gdx.graphics.getDeltaTime());
}
Player.velocity.y = 320;
我的问题是,当我触摸屏幕让鸟儿飞翔时,我没有得到顺时针的平稳旋转。这只鸟看起来像船一样摇晃。
我知道这和起源有关,但我被困在这里了
看到我的代码了吗
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;
通过批处理旋转纹理区域我是否可以看到getANGLE的代码,这可能是找到问题所在的重要部分,在getANGLE中,它调整角度。我让它工作了。而是旋转纹理区域。非常感谢。