2D Java游戏编程动画问题

时间:2014-09-21 18:43:43

标签: java game-physics

我正在制作一个游泳动画。当玩家与waterTile发生碰撞时,当玩家离开(lt)时游戏动画不会播放,当玩家向右移动(rt)时,游戏动画会播放。

以下是Player.java的Render方法: -EDITED -

if (isSwimming){
        if (up) {
            swimUp.render(g, x, y, Game.TILESIZE * Game.SCALE, Game.TILESIZE * Game.SCALE);
        } 
        if (dn){
            swimDown.render(g, x, y, Game.TILESIZE * Game.SCALE, Game.TILESIZE * Game.SCALE);
        }
        if (rt){
            swimRight.render(g, x, y, Game.TILESIZE * Game.SCALE, Game.TILESIZE * Game.SCALE);
        }
        if (lt){
            swimLeft.render(g, x, y, Game.TILESIZE * Game.SCALE, Game.TILESIZE * Game.SCALE);
        }
    }       
 if (!isSwimming){
        if(up){
            upAnimation.render(g, x, y, Game.TILESIZE * Game.SCALE, Game.TILESIZE * Game.SCALE);
        } 
        if (dn){
            downAnimation.render(g, x, y, Game.TILESIZE * Game.SCALE, Game.TILESIZE * Game.SCALE);
        }
        if (rt){
            rightAnimation.render(g, x, y, Game.TILESIZE * Game.SCALE, Game.TILESIZE * Game.SCALE);
        }
        if (lt){
            leftAnimation.render(g, x, y, Game.TILESIZE * Game.SCALE, Game.TILESIZE * Game.SCALE);
        } else
            idle.render(g, x, y, Game.TILESIZE * Game.SCALE, Game.TILESIZE * Game.SCALE);

}

此外,值得注意的是,没有显示错误。

0 个答案:

没有答案