旋转纹理区域
我正在构建一个手机游戏,并试图实现与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;
通过批处理