http://puu.sh/gdopH/3a39a2e0ab.gif
这是我目前处理动画的状态 然而,它不是直接进行缩放和移动,而是首先向左反弹然后以曲线向上移动到原来的位置。
这是我目前的代码:
private float scale = 1f;
private int introX = 1024, introY = 360;
private boolean introSpinning = false;
@Override
public void render(GameContainer gameContainer, Graphics graphics) throws SlickException {
if(mode == Mode.MENU) {
Animation anim = Player.iFacing[Direction.LEFT.ordinal()]; // Fetching the player animation.
if(introSpinning) {
anim = Player.spinAnim;
if(scale <= 3f)
scale += 0.01f;
if(introY > 100)
introY -= 2;
graphics.scale(scale, scale);
graphics.drawAnimation(anim, introX - ((scale / 3) * 350), introY - (scale * 20));
}
else {
if(introX > 508)
introX -= 2;
else {
introSpinning = true;
}
graphics.drawAnimation(anim, introX, introY);
}
}
}
答案 0 :(得分:0)
管理自己解决它:)
不得不将drawAnimation
改为不同的数学:
graphics.drawAnimation(anim, introX / scale - (anim.getWidth() / 3), introY / scale);
~Lordmau5。