import greenfoot.*; /** * This is a stick man. Make him run and jump. * * @author * @version */ public class Stickman extends Actor { /** * Make the stickman act. */ public void act() { //3.31: Make the stickman move to the right so that when you run scenario he walks over to the right side of the screen// move(5); int soundLevel; moveLeftIfNoise(); //The stickman moves at edge if(isAtEdge()) gameOver(); } } /* 3.32 Using an if statemt and the micorphone input method to make sticman move right only when you make some noise * */ public void soundLevel() { int soundLevel // Greenfoot getMicLevel value is stored in the soundLevel// soundLevel = Greenfoot.getMicLevel(); //It checks whether if soundLevel is greater than three// if(soundLevel>3) { /* It allows the stickman to move according to the sound level */ move(soundLevel): } } /** 3.34 Move the code that moves left when you make noise into its own method.Call this method moveLeftIfNoise.Test. * */ public Void moveLeftIfNoise () { /* This method will play sound while moving left */ Greenfoot.playSound("slurp.wav"); //This allows the stickman to move left// move(-4); } } /**3.35 Add another method to your class called gameOver.This method should be called if the stickman reaches the edge of the screen */ public void gameOver() { //This predefined method is used to play the sound// Greenfoot.playSound("slurp.wav"); //This predefined method is used to stop the stickman Greenfoot.stop(); } }