After modifying the Greenfoot book Ch. 5 scenario, I've run into problems. Whenever the scenario is run, all the sounds would play at once, and error messages would appear in a separate window. Now, after attempting to solve it, it compiles with no errors but the stage does not appear. Help! Given, the points where the keys should spawn might not be orderly, as i can't see them to fix it. Thank you.
import greenfoot.*; // (World, Actor, GreenfootImage, and Greenfoot)
/**
* A piano that can be played with the computer keyboard.
*
* @author: M. Kolling
* @version: 0.1
*/
public class Piano extends World
{
private String whiteKeys =
{ "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "\\" };
private String whiteNotes =
{ "ZL", "BoF", "MoF", "NoS", "PoL", "RoS", "SoW", "TT", "Shop", "Epona", "Saria", "Sun" };
private String blackKeys =
{ "q", "w", "e", "t", "y", "u", "i", "o", "p", "" };
private String blackNotes =
{ "Wmll", "Lost Woods", "LOnLon", "HF", "Goron", "KK", "ZD", "KV", "DADADA", "DAAAA", "End" };
// Assigning keys and sounds
/**
* * Make the piano.
*/
public Piano()
{
super(1500, 400, 1);
makeKeys();
}
private void makeKeys()
{
for(int i = 0; i < whiteKeys.length; i++)
{
Key key = new Key(whiteKeys,whiteNotes+".mp3", "Rupee3.png", "Rupee3-2.png");
addObject(key, 50 + (i*110), 80);
}
for(int i = 0; i < blackKeys.length; i++){
if( ! blackKeys.equals("") ) {
Key key = new Key(blackKeys, blackNotes+".mp3", "Rupee1.png", "Rupee1-1.png");
addObject(key, 50 + (1*110), 240);
}
}
}
}


