Your render method already does clear the screen (about 60 times per second):

public void render(SpriteBatch sb) {, 100f, 100f,1.0f);//sets the clear color to gray;// CLEARS THE SCREEN
    Buttons.setUp(sb, font, img, gsm);
    sb.draw(img, 170, 700, 180, 140);//draws the button again
    font.draw(sb, "to hobby", 225, 705);//draws the text on the button again


So the problem probably is something else. It’s probably a good idea to create a new question to find the cause of the problem (include a description of what happens when “it automatically ends”, exceptions or errors that are shown in the console output, and if possible a minimal reproducable example)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top