i am adding sound to my object but when i compile and run greenfoot i get a runtime error. the sound file is working fine and in .wav format. how can i amend this problem?
public class Ball extends Actor { private int deltaX; private int deltaY; /** * Create a ball with random movement */ { deltaX = Greenfoot.getRandomNumber(11) - 5; deltaY = Greenfoot.getRandomNumber(11) - 5; } /** * Act, Move and Produce Smoke * */ public void act() { makeSmoke(); // use this code to declare make smoke move(); // use this code to declare your object to move } /** * Move the ball. Then check whether we've hit a wall */ public void move() { setLocation (getX() + deltaX, getY() + deltaY); checkWalls(); // use this code to check that the object has hit a wall Greenfoot.playSound("breathe.wav"); } /** * Produce a puff of smoke */ public void makeSmoke() { getWorld().addObject ( new Smoke(), getX(), getY()); } /** * Check whether we've hit one of the walls. Reverse direction if necessary */ private void checkWalls() { if (getX() == 0 || getX() == getWorld().getWidth()-1) { deltaX = - deltaX; } if (getY() == 0 || getY() == getWorld().getHeight()-1) { deltaY = - deltaY; } } }