小编nco*_*n97的帖子

运行5分钟后,我的libgdx游戏崩溃并变成红色

public class PlayScreen implements Screen{

    Stage stage;

    LabelStyle style;
    BitmapFont font;

    TextureAtlas backbuttonatlas;
    TextButtonStyle backbuttonstyle;
    TextButton backbutton;
    Skin backskin;

    SpriteBatch batch;
    Texture pibe;
    Sprite sprite;
    Vector2 position;
    Game game;

    Texture texture;

    public PlayScreen(Game game){
        this.game=game;
    }

    @Override
    public void render(float delta) {

    stage=new Stage();

    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);


    if(Gdx.input.isKeyPressed(Keys.W))
    {
        position.x+=5f;
    }
    if(Gdx.input.isKeyPressed(Keys.A))
    {
        position.y-=5f;
    }
    if(Gdx.input.isKeyPressed(Keys.S))
    {
        position.x-=5f;
    }
    if(Gdx.input.isKeyPressed(Keys.D))
    {
        position.y+=5f;
    }

    if(Gdx.input.isTouched()==true)
    {
        if(Gdx.input.getY()>Gdx.graphics.getHeight()/2)
        {
        position.x-=5;
        }
        if(Gdx.input.getY()<Gdx.graphics.getHeight()/2)
        {
            position.x+=5;
        }
        if(Gdx.input.getX()>Gdx.graphics.getWidth()/2)
        {
            position.y+=5;
        }
        if(Gdx.input.getX()<Gdx.graphics.getWidth()/2) …
Run Code Online (Sandbox Code Playgroud)

android libgdx

1
推荐指数
1
解决办法
384
查看次数

标签 统计

android ×1

libgdx ×1