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

2013/10/28

Emoticon Project- Gruver- so hard!!!

1
2
3
4
5
ksksks ksksks

2013/10/30

#
OH! didn't see that.
ksksks ksksks

2013/10/30

#
Fixed that, but now line 16 "can't find variable sound"
ksksks ksksks

2013/10/30

#
if it isn't an integer, boolean or anything else... wait do I even need it?
danpost danpost

2013/10/30

#
You probably did not follow instructions properly (especially instruction (2)). What code do you have at this point?
danpost danpost

2013/10/30

#
ksksks wrote...
if it isn't an integer, boolean or anything else... wait do I even need it?
Yes, you need it. Or it would not know what sound to play when it comes time to play it.
ksksks ksksks

2013/10/30

#
mport 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 String[] soundFile;
  
   
   private void emoticon(String image, String soundFile)
   {
      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");
         }
            
    }    
}
ksksks ksksks

2013/10/30

#
line 16. BIG problem
ksksks ksksks

2013/10/30

#
How do I set it to be a variable?
ksksks ksksks

2013/10/30

#
Gotta go.
Kartoffelbrot Kartoffelbrot

2013/10/30

#
I think you mean:
public Emoticon(String image, String soundFile)  
{  
      setImage( image + ".png");
      sound = soundFile;  
} 
danpost danpost

2013/10/30

#
@Kartoffelbrot, the problem is the type given the 'sound' field. ksksks has it typed as an array, where is should just be a single String object. I have asked him to correct this already, but, as yet, he has not.
Kartoffelbrot Kartoffelbrot

2013/10/30

#
Oh yes, you are right, I didn't noticed that.
danpost danpost

2013/10/30

#
Kartoffelbrot wrote...
I think you mean:
public Emoticon(String image, String soundFile)  
{  
      setImage( image + ".png");
      sound = soundFile;  
} 
This is no different (as far as the compiler looks at it). Blank space is all blank space, and the amount of it has no effect on the way the statements are interpreted by the compiler.
Kartoffelbrot Kartoffelbrot

2013/10/30

#
I thought
ksksks wrote...
private void emoticon(String image, String soundFile) { setImage( image + ".png"); sound = soundFile; }
wanted to have a constructor with this.
ksksks ksksks

2013/11/1

#
danpost; you are so sexist! I am a SHE!!!!!!!!!!!!!!!!!!!!!
There are more replies on the next page.
1
2
3
4
5