本文介绍了LIBGDX中的黑色条纹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做马里奥兄弟游戏,我认为渲染存在问题.我附上了一些照片,以更好地说明问题.我不知道为什么会这样.

I´m doing a mario bross game and I have problems i think with the rendering. I attached some photos to explain better the issue. I don´t have any idea why this happen.

有时会出现垂直条纹.

提前谢谢.

@Override
public void render(float delta) {
    update(delta);
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    renderer.render();
    b2dr.render(world, gamecam.combined);
    game.batch.setProjectionMatrix(gamecam.combined);
    game.batch.begin();
    player.draw(game.batch);
    for (Enemigo enemigo:creator.getEnemies()) {
        enemigo.draw(game.batch);
    }
    for(Item item : items){
        item.draw(game.batch);
    }
    for (Plataforma plataforma : creator.getPlataformas()){
        plataforma.draw(game.batch);
    }
    game.batch.end();
    game.batch.setProjectionMatrix(hud.stage.getCamera().combined);
    hud.stage.draw();

    if(gameOver()){
        game.setScreen(new GameOverScreen(game));
        dispose();
    }
}

推荐答案

imo,首先尝试简单的方法,您是否使用2的幂(平铺编辑器中使用的图像)?例如16px X 16px,32px X 32px,128px X 64px..etc

imo, try the easy way first, do you use power of two (images used in tiled editor)? like 16px X 16px, 32px X 32px, 128px X 64px..etc

例如如果您使用图素宽度和tileheght创建图像为64px X 64px的新tiledmap,则可以将图素大小WidthxHeight设置为64px或32px或16px,因此该单元格将被您的图素填充(不会出现纹理出血)

for eg. if you create new tiledmap with image 64px X 64px as tilewidth and tileheght, then you could set tile size WidthxHeight to 64px or 32px or 16px therefore the cell will be filled with your tile (texture bleeding wont appear)

这篇关于LIBGDX中的黑色条纹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 21:12