Java 运行时异常LibGDX错误,但为什么它会抱怨TextureRegion?

Java 运行时异常LibGDX错误,但为什么它会抱怨TextureRegion?,java,android,libgdx,Java,Android,Libgdx,MenuScreen工作正常,但我不明白为什么会出现这个错误。 在“开始”菜单上按“开始游戏”后,在实际游戏开始时发生 公共类NinjaRabbitGraphicsProcessor实现图形处理器、电报{ 私有静态最终字符串WALK\u REGION=“WALK”; 私有静态最终字符串跳转\u REGION=“JUMP”; //私有静态最终字符串DUCK\u REGION=“DUCK”; 专用静态最终矢量2重生位置=新矢量2(0.6f,3.2f); 私人最终织物; 私人最终Box2Sprite

MenuScreen工作正常,但我不明白为什么会出现这个错误。 在“开始”菜单上按“开始游戏”后,在实际游戏开始时发生

公共类NinjaRabbitGraphicsProcessor实现图形处理器、电报{
私有静态最终字符串WALK\u REGION=“WALK”;
私有静态最终字符串跳转\u REGION=“JUMP”;
//私有静态最终字符串DUCK\u REGION=“DUCK”;
专用静态最终矢量2重生位置=新矢量2(0.6f,3.2f);
私人最终织物;
私人最终Box2Sprite standingSprite;
私有最终动画Box2Sprite walkRightSprite;
私有最终动画Box2Sprite walkLeftSprite;
私人最终动画Box2Sprite jumpSprite;
//私人最终动画Box2Sprite duckSprite;
公共NinjaRabbitGraphicsProcessor(最终资产管理者资产){
textureAtlas=assets.get(assets.NINJA\u RABBIT\u ATLAS);
数组walkingSprites=textureAtlas.createSprites(WALK_区域);
standingSprite=newbox2sprite(walkingSprites.first());
standingSprite.setAdjustSize(假);
standingSprite.setSize(standingSprite.getWidth()/ninjarabbittgame.PPM,
standingSprite.getHeight()/NinjaRabbitGame.PPM);
动画=新动画(1/12.0f,walkingSprites,Animation.PlayMode.LOOP);
walkRightSprite=新的AnimatedBox2Sprite(新的AnimatedSprite(动画));
walkRightSprite.setAdjustSize(false);
walkRightSprite.setSize(walkRightSprite.getWidth()/NinjaRabbitGame.PPM,
walkRightSprite.getHeight()/NinjaRabbitGame.PPM);
动画=新动画(1/12.0f,textureAtlas.createSprites(漫游区域),animation.PlayMode.LOOP);
walkLeftSprite=新的AnimatedBox2Sprite(新的AnimatedSprite(动画));
flipFrames(真、假、真);
walkLeftSprite.setAdjustSize(false);
walkLeftSprite.setSize(walkLeftSprite.getWidth()/NinjaRabbitGame.PPM,
walkLeftSprite.getHeight()/NinjaRabbitGame.PPM);
动画=新动画(1/10.0f,textureAtlas.createSprites(跳跃区域));
jumpSprite=新的AnimatedBox2Sprite(新的AnimatedSprite(动画));
jumpSprite.setAdjustSize(错误);
jumpSprite.setSize(jumpSprite.getWidth()/NinjaRabbitGame.PPM,
jumpSprite.getHeight()/ninjarabbittgame.PPM);
MessageManager.getInstance().addListener(这是MessageType.DEAD.code());
}
/*
*(非Javadoc)
*
*@see ar.uba.fi.game.graphics.GraphicsProcessor#update(ar.uba.fi.game.entity.entity,
*com.badlogic.gdx.graphics.Camera)
*/
@凌驾
公共无效更新(最终实体字符、最终摄影机){
camera.position.x=character.getBody()==null?0.0f:
character.getBody().getPosition().x+camera.viewportWidth*0.25f;
}
/*
*(非Javadoc)
*
*@see ar.uba.fi.game.entity.GraphicsProcessor#draw(com.badlogic.gdx.graphics.g2d.Batch)
*/
@凌驾
公共作废绘制(最终实体字符,最终批次){
Box2DSprite帧=空;
if(character.isInState(ninjarabbittate.JUMP)){
jumpSprite.flipFrames(!(Direction.RIGHT.equals(character.getDirection())^jumpSprite.isFlipX()),false,false);
帧=jumpSprite;
}else if(character.isInState(ninjarabbittate.RIGHT)){
帧=walkRightSprite;
字符.setDirection(Direction.RIGHT);
}else if(character.isInState(ninjarabbittate.LEFT)){
帧=walkLeftSprite;
字符.设置方向(方向.左);
}else if(character.isInState(ninjarabbittate.DUCK)){
//frame=duckSprite;
}否则{
standingSprite.flip(!(Direction.RIGHT.equals(character.getDirection())^standingSprite.isFlipX()),false);
框架=站立弹簧;
//duckSprite.设定时间(0.0f);
jumpSprite.setTime(0.0f);
}
//以下数字来自伏都教
帧设置位置(
-frame.getWidth()*0.5f+
box2utils.width(character.getBody())/(Direction.RIGHT.equals(character.getDirection())
?2.8f:1.55f),
-frame.getHeight()*0.5f+box2utils.width(character.getBody())+0.36f);
frame.draw(批处理,character.getBody());
}
@凌驾
公共布尔handleMessage(最终电报消息){
实体字符=(实体)msg.extraInfo;
character.getBody().setTransform(重生位置,character.getBody().getAngle());
character.changeState(ninjarabbittate.IDLE);
字符.setDirection(Direction.RIGHT);
返回true;
}
@凌驾
公共空间处置(){
}
@凌驾
公共空心调整大小(最终整型宽度、最终整型高度){
}
}
我显然没有编译时错误,所以我找不到应该在哪里

非常感谢你的帮助。请详细说明


不得不将build.gradle更改为我使用的早期版本1.9.3,现在可以正常工作了

public class NinjaRabbitGraphicsProcessor implements GraphicsProcessor, Telegraph {
    private static final String WALK_REGION = "walk";
    private static final String JUMP_REGION = "jump";
    // private static final String DUCK_REGION = "duck";
    private static final Vector2 RESPAWN_POSITION = new Vector2(0.6f, 3.2f);

    private final TextureAtlas textureAtlas;
    private final Box2DSprite standingSprite;
    private final AnimatedBox2DSprite walkRightSprite;
    private final AnimatedBox2DSprite walkLeftSprite;
    private final AnimatedBox2DSprite jumpSprite;

    // private final AnimatedBox2DSprite duckSprite;

    public NinjaRabbitGraphicsProcessor(final AssetManager assets) {
        textureAtlas = assets.get(Assets.NINJA_RABBIT_ATLAS);

        Array<Sprite> walkingSprites = textureAtlas.createSprites(WALK_REGION);
        standingSprite = new Box2DSprite(walkingSprites.first());
        standingSprite.setAdjustSize(false);
        standingSprite.setSize(standingSprite.getWidth() / NinjaRabbitGame.PPM,
                standingSprite.getHeight() / NinjaRabbitGame.PPM);

        Animation animation = new Animation(1 / 12.0f, walkingSprites, Animation.PlayMode.LOOP);
        walkRightSprite = new AnimatedBox2DSprite(new AnimatedSprite(animation));
        walkRightSprite.setAdjustSize(false);
        walkRightSprite.setSize(walkRightSprite.getWidth() / NinjaRabbitGame.PPM,
                walkRightSprite.getHeight() / NinjaRabbitGame.PPM);

        animation = new Animation(1 / 12.0f, textureAtlas.createSprites(WALK_REGION), Animation.PlayMode.LOOP);
        walkLeftSprite = new AnimatedBox2DSprite(new AnimatedSprite(animation));
        walkLeftSprite.flipFrames(true, false, true);
        walkLeftSprite.setAdjustSize(false);
        walkLeftSprite.setSize(walkLeftSprite.getWidth() / NinjaRabbitGame.PPM,
                walkLeftSprite.getHeight() / NinjaRabbitGame.PPM);

        animation = new Animation(1 / 10.0f, textureAtlas.createSprites(JUMP_REGION));
        jumpSprite = new AnimatedBox2DSprite(new AnimatedSprite(animation));
        jumpSprite.setAdjustSize(false);
        jumpSprite.setSize(jumpSprite.getWidth() / NinjaRabbitGame.PPM,
                jumpSprite.getHeight() / NinjaRabbitGame.PPM);



        MessageManager.getInstance().addListener(this, MessageType.DEAD.code());
    }

    /*
     * (non-Javadoc)
     *
     * @see ar.uba.fi.game.graphics.GraphicsProcessor#update(ar.uba.fi.game.entity.Entity,
     * com.badlogic.gdx.graphics.Camera)
     */
    @Override
    public void update(final Entity character, final Camera camera) {
        camera.position.x = character.getBody() == null ? 0.0f :
                character.getBody().getPosition().x + camera.viewportWidth * 0.25f;
    }

    /*
     * (non-Javadoc)
     *
     * @see ar.uba.fi.game.entity.GraphicsProcessor#draw(com.badlogic.gdx.graphics.g2d.Batch)
     */
    @Override
    public void draw(final Entity character, final Batch batch) {
        Box2DSprite frame = null;

        if (character.isInState(NinjaRabbitState.JUMP)) {
            jumpSprite.flipFrames(!(Direction.RIGHT.equals(character.getDirection()) ^ jumpSprite.isFlipX()), false, false);
            frame = jumpSprite;
        } else if (character.isInState(NinjaRabbitState.RIGHT)) {
            frame = walkRightSprite;
            character.setDirection(Direction.RIGHT);
        } else if (character.isInState(NinjaRabbitState.LEFT)) {
            frame = walkLeftSprite;
            character.setDirection(Direction.LEFT);
        } else if (character.isInState(NinjaRabbitState.DUCK)) {
            // frame = duckSprite;
        } else {
            standingSprite.flip(!(Direction.RIGHT.equals(character.getDirection()) ^ standingSprite.isFlipX()), false);
            frame = standingSprite;
            // duckSprite.setTime(0.0f);
            jumpSprite.setTime(0.0f);
        }

        // Following numbers came from voodoo
        frame.setPosition(
                -frame.getWidth() * 0.5f +
                        Box2DUtils.width(character.getBody()) / (Direction.RIGHT.equals(character.getDirection())
                                ? 2.8f : 1.55f),
                -frame.getHeight() * 0.5f + Box2DUtils.width(character.getBody()) + 0.36f);

        frame.draw(batch, character.getBody());
    }

    @Override
    public boolean handleMessage(final Telegram msg) {
        Entity character = (Entity) msg.extraInfo;
        character.getBody().setTransform(RESPAWN_POSITION, character.getBody().getAngle());
        character.changeState(NinjaRabbitState.IDLE);
        character.setDirection(Direction.RIGHT);
        return true;
    }

    @Override
    public void dispose() {

    }

    @Override
    public void resize(final int width, final int height) {
    }
}