Thanks, I did do that! I can't figure out what is still wrong! @Kartoffelbrot @danpost
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Emoticon here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Emoticon extends Actor
{
private void emoticon(String image[i], String soundFile[i])
{
setImage( image + ".png");
sound = soundFile;
}
/**
* Act - do whatever the Emoticon wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// When the mouse is click on this object, play the sound.
if(Greenfoot.mouseClicked(this))
{
Greenfoot.playSound(sound + ".wav");
}
}
}
private GreenfootSound sound;
sound = new GreenfootSound(soundFile + "wav");
sound.play();
sound = new GreenfootSound(soundFile + "wav");
sound = new GreenfootSound(soundFile + ".wav");
sound = new GreenfootSound(soundFile + "wav");
sound = new GreenfootSound(soundFile + ".wav");