# Libgdx if statement is not working well

I am trying to make the player die when it hits the rock or the time is up and the score is not reached, in this code at the first if statement it works when Rockhit is true, the player jump and disappear at the bottom of screen and the music is work very well, but when the time is 0 and score is not reached , the player is jump and keeps going out of the top of screen and the sound is work but slow and not clear. (notice: that before I adding the Rockhit condition the player was going up out of screen and the voice wasn't clear) this is the code:

  public State getState()
{
//Gdx.app.log(Float.toString(b2body.getLinearVelocity().x),"hi");
if ((Hud.getTime()==0&& Hud.getScore()<(level*15)+50)|| Rockhit()) {
Fruits.manager.get("music/Backmusic.ogg", Music.class).stop();
Filter filter = new Filter();
for (Fixture fixture : b2body.getFixtureList())
fixture.setFilterData(filter);
b2body.applyLinearImpulse(new Vector2(0, 5f), b2body.getWorldCenter(), true);
//b2body.applyLinearImpulse(new Vector2(0,-2.5f), b2body.getWorldCenter(), true);
Fruits.manager.get("music/fail.mp3", Sound.class).play();

}

if((Hud.getTime()==0&& Hud.getScore()>=(level*18)+50)|| (Hud.getScore()>=(level*15)+50)) {
Fruits.manager.get("music/Backmusic.ogg", Music.class).stop();
Fruits.manager.get("music/cheering.mp3", Sound.class).play();
return State.SUCCESS;
}
if (b2body.getLinearVelocity().x!=0)
return State.RUNNING;
else
return State.STANDING;

}


I don't know if the method you posted is called every frame, but (Hud.getTime()==0&& Hud.getScore()<(level*15)+50) will always be true once the time is up. (thus giving that linear impulse and starting the sound every frame). I would try to nullate the score.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.40918445587158203, "perplexity": 3484.597016833292}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-10/segments/1581875143805.13/warc/CC-MAIN-20200218180919-20200218210919-00448.warc.gz"}