Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
Intentando dibujar un sprite en libgdx y no aparece nada

He estado tratando de hacer que esto funcione por un tiempo y no sé cuál es el problema... Puedo dibujar animaciones por alguna razón, pero si trato de dibujar una textura estática simple, nada. Solo quiero dibujar un sprite en las coordenadas dadas y tener un cuerpo box2d para colisiones. Puedo hacer que el cuerpo funcione también, pero no la textura. en este momento, estoy tratando de reconstruir todo, pero aún no hay progreso. mi objeto es

 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);} }

En el nivel se dibuja como

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

esto llena RB (una lista de arreglos) de los objetos del mapa TMX en mosaico que se relacionan con los sprites.

luego, cuando renderizo en PlayScreen, uso

 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(); }

esto llama a la función render desde arriba.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!