Fix sound bug on game resume
parent
5ae603cb06
commit
3359ab9ff1
|
@ -24,7 +24,7 @@ public class Player extends GenericSprite {
|
||||||
|
|
||||||
public static final int walkSpeedCap = 5;
|
public static final int walkSpeedCap = 5;
|
||||||
public boolean alive;
|
public boolean alive;
|
||||||
private transient final Sound jump = new Sound("sound/jump.wav");
|
private transient Sound jump = new Sound("sound/jump.wav");
|
||||||
|
|
||||||
public static int mouseX;
|
public static int mouseX;
|
||||||
public static int mouseY;
|
public static int mouseY;
|
||||||
|
@ -252,9 +252,14 @@ public class Player extends GenericSprite {
|
||||||
y-=1;
|
y-=1;
|
||||||
isGrounded = false;
|
isGrounded = false;
|
||||||
if(canUpdate(0,-8)) {
|
if(canUpdate(0,-8)) {
|
||||||
if (jump != null) {
|
if (jump == null) {
|
||||||
jump.start();
|
try {
|
||||||
|
jump = new Sound("sound/jump.wav");
|
||||||
|
} catch (UnsupportedAudioFileException | LineUnavailableException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
jump.start();
|
||||||
}
|
}
|
||||||
yVelocity = -10;
|
yVelocity = -10;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue