This site requires JavaScript, please enable it in your browser!
Greenfoot back
edwright
edwright wrote ...

2014/8/13

Piano # key on UK keyboard

edwright edwright

2014/8/13

#
I'm trying to fill the array from chapter 5.4 from the Piano Scenario in the Introduction to Greenfoot book. My keyboard has a middle row that reads: a s d f g h j k l ; ' # I'm trying to get the piano to play the "4g.wav" sound file when I press the # key. However, I can't! I've tried adding it to the array as "#" and as "\#". The first compiles and when it is run, nothing happens on pressing the # key. The second does not compile and gives an illegal escape character error... Help please????
danpost danpost

2014/8/13

#
You should put a 'System.out.println(Greenfoot.getKey());' line in your code and check the output when you press the key. Whatever output you get should be what you use for that key.
edwright edwright

2014/8/13

#
Hi danpost, Thanks for your reply. I have put the line of code you suggested into the code (in the play() method) which does tell me which keys have been pressed but it does not produce an output when the # key is pressed. Any more suggestions please?
danpost danpost

2014/8/13

#
edwright wrote...
Any more suggestions please?
You may just have to use a different key. Maybe jump up to the next row of keys.
You need to login to post a reply.