**FIXED**
After my previous quarrel with some other classes, I've managed to iron out almost all of the bugs from my game, except this one. The following class has an interesting problem:
Seems simple enough, though when it sets the volume to half (the image still changes) the audio is still muted until I set it to full. Now here's the code that is accessing the volume level:
Strange how it works for 0 and 100, but not for 50. Did I miss something in there?
public class VolumeSelect extends Actor { public int volumeLevel = 100; public void act() { checkClick(); } public void checkClick() { if(Greenfoot.mouseClicked(this)) { if(volumeLevel == 100) { setImage("VolumeOff.png"); volumeLevel = 0; } else if(volumeLevel == 50) { setImage("VolumeFull.png"); volumeLevel = 100; } else if(volumeLevel == 0) { setImage("VolumeHalf.png"); volumeLevel = 50; } } } }
public void addedToWorld(World world) { //load the injury sound injury.setVolume(0); injury.play(); room = (Room)getWorld(); volumeselect = room.volumeselect; } public void damagePlayer(int damage) { health = health - damage; injury.setVolume(volumeselect.volumeLevel); injury.play(); }