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

2018/10/24

Need help with piano project

Toodumbtocode Toodumbtocode

2018/10/24

#
I have a powerpoint that tells me to add this code to make a single key. When I add it, it doesnt work. What's wrong? Please Help!!! Thank you.
 public Piano() 
    {
    
     
     addObject (new Key g, "3a.wav",300,180));




    }
Jeph Jeph

2018/10/24

#
Is there a link to this power point?
Super_Hippo Super_Hippo

2018/10/24

#
If that is the whole code in your world class, then the first thing which is missing is the super call to create the world. Problem with the line in particular: The addObject method requires three parameters - an object and two ints. You have four parameters and the first one doesn't make any sense. Depending on how your Key class looks, the line could look like this:
addObject(new Key("g", "3a,wav"), 300, 180);
You need to login to post a reply.