Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

159
Vistas
Attempting to draw a sprite in libgdx and nothing appears

I've been trying to get this to work for a while now, and i dont know what the problem is...I can draw animations for some reason, but if i try to draw a simple static texture, nothing. I just want to draw a sprite at given coordinates and have a box2d body for collisions. I can get the body to work too, just not the texture. right now, I am trying to rebuild the whole thing, but still no progress. my object is

public class RoadBlock extends Sprite {
    private TextureAtlas atlas;

    public RoadBlock (PlayScreen screen, float x, float y) {
        atlas = new 
        TextureAtlas(Gdx.files.internal("tunnelPics/tunnelAtlas.atlas"));
        setPosition(x, y);
        setRegion(atlas.findRegion("barbSmol"), 0, 0, 120, 75);
    }
    public void draw(Batch batch) {super.draw(batch);}
}

In the level it's drawn as

public void render(MyGdxGame game){
    for(Sprite RB: RBs) {
        RB.draw(game.batch);
    }
}

this populates RB (an arrayList) from the tiled TMX map objects that relate to the sprites.

then in when rendering in the playScreen, i use

public void render(float delta) {
    update(delta);
    //background color
    Gdx.gl.glClearColor(0,0,0,1);
    Gdx.gl.glEnable(GL20.GL_BLEND); //enable transparent images
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    //render
    renderer.render();
    game.batch.enableBlending(); 
    game.batch.setProjectionMatrix(gamecam.combined);
    game.batch.begin();
    //render character
    player.draw(game.batch);
    //render current level
    curLevel.render(game);
    game.batch.end();
}

this calls the render function from above.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda