gpt4 book ai didi

java - Slick2D - 动画缩放和移 Action 为介绍?

转载 作者:太空宇宙 更新时间:2023-11-04 14:07:09 25 4
gpt4 key购买 nike

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);
}
}
}

最佳答案

我自己解决了这个问题:)
必须将 drawAnimation 更改为不同的数学:

graphics.drawAnimation(anim, introX / scale - (anim.getWidth() / 3), introY / scale);

~ Lordmau5。

关于java - Slick2D - 动画缩放和移 Action 为介绍?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28742661/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com