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

2016/2/13

java exercise 3.32 (completely lost - please help)

bonney bonney

2016/2/13

#
I read chapter 3 and went through all the exercises 3-4 times. Still do not understand how to do number 3.32. So far i've got. The second part isn't even mine. I saw another guy post on here about the same question and basically used his with different code. I dont understand what they want me to do when it says "Using an if-statement and the microphone input method you found above, make the stickman move right only when you make some noise. Experiment with different values for the noise level." (how do i do that ?). The last 2 chapters were easy compared to this and now i feel like an idiot. public class Stickman extends Actor { /** * Make the stickman act. */ public void act() { Play(); } /** play music and move stickman * */ public void Play() { Greenfoot.playSound("hit.wav"); move(3); } }
bonney bonney

2016/2/14

#
Any tip would be appreciated. Still haven't gotten it to work.
danpost danpost

2016/2/14

#
Okay, what method is being referred to by "the microphone input method you found above"? and what information does the method return? and what range of values, if any, are returned from the method call? Then, what can you possibly compare to any value it returns? Then, what attempt have you in trying the method in your code?
bonney bonney

2016/2/15

#
I changed it a little bit. public class Stickman extends Actor { /** * Make the stickman act. */ public void act() { move(5); if (Greenfoot.getMicLevel()>3) { move(8); } } } Thx for helping me out Dan. Those questions you asked basically gave me a better clue.
cabennet cabennet

2016/8/28

#
I am trying to make this work as well. I cut and past from bonney, still no luck. I tried the sound recorder and it works fine, Greentfoot recognizes the mic. Any help would be appreciated.
/**
 * This is a stick man. Make him run and jump.
 * 
 * @author 
 * @version 
 */
public class Stickman extends Actor
{
    /**
     * Make the stickman act.
     */
    public void act() 
      {
        move(1);
        
        if (Greenfoot.getMicLevel()>1)
        {
            move(20);
        }
    }    
}
You need to login to post a reply.