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

2013/10/28

Emoticon Project- Gruver- so hard!!!

2
3
4
5
ksksks ksksks

2013/11/1

#
Thanks, I did do that! I can't figure out what is still wrong! @Kartoffelbrot @danpost
ksksks ksksks

2013/11/1

#
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");
         }
            
    }    
}
How come this is wrong!!
ksksks ksksks

2013/11/1

#
line 14, 17
danpost danpost

2013/11/1

#
@ksksks, my apologies.
danpost danpost

2013/11/1

#
Remove the ''s from line 14. Add add at line 12:
private GreenfootSound sound;
Change line 17 to:
sound = new GreenfootSound(soundFile + "wav");
and change line 30 to :
sound.play();
ksksks ksksks

2013/11/1

#
I forgive you dp. Simple mistake.
ksksks ksksks

2013/11/1

#
Thankyou.
davmac davmac

2013/11/1

#
I think when danpost wrote:
    sound = new GreenfootSound(soundFile + "wav");  
he may have meant:
    sound = new GreenfootSound(soundFile + ".wav");  
danpost danpost

2013/11/1

#
davmac wrote...
I think when danpost wrote:
    sound = new GreenfootSound(soundFile + "wav");  
he may have meant:
    sound = new GreenfootSound(soundFile + ".wav");  
I did.
ksksks ksksks

2013/11/1

#
It can't find the variable sound now.
danpost danpost

2013/11/1

#
danpost wrote...
Add at line 12:
private GreenfootSound sound;
Did you do this?
ksksks ksksks

2013/11/1

#
@ davMac, strange that you see that, it's obvious. How do I get that variable, and can you make a browser auto-refresh?
ksksks ksksks

2013/11/1

#
Not yet. getting it.
ksksks ksksks

2013/11/1

#
Can I pull a string using get world?
danpost danpost

2013/11/1

#
ksksks wrote...
Can I pull a string using get world?
Do not know what you mean by 'pull a string'
You need to login to post a reply.
2
3
4
5