don_donnay 0 Newbie Poster

I have an exam tomorrow and this is a practice program, I am very lost could some body help me please
Moving Hero
The hero in this scenario should move "forward" whenever act is called. Note that Hero is a subclass of Actor, so there is no move method defined, you must define the method yourself. There is code already in the scenario to help you with this. You simply need to fill in the move method body.

Hero Checks for Edges and Wrap Around
The hero must check for the edges of the world and wrap around if it reaches an edge left/right and top/bottom. There is a hint for this in the scenario already as well. Create a method named checkForEdges and use it to help you detect the edges of the world and move the hero around.

Hero Turns Right
When the user presses the right arrow key, the hero should turn right. The amount of degrees is up to you. You need to create a method named turnRight() in your Hero class.

Hero Turns Left
When the user presses the left arrow key, the hero should turn left. The amount of degrees is up to you. You need to create a method named turnLeft() in your Hero class.

Create Additional Actors
You should create classes for each of the following objects that will be in the scenario: Mushroom, Flower, GoldBall, TeddyBear, Skull.

Populate the Scenario
Your scenario should open with the following at various locations throughout the world: one hero, six mushrooms, four flowers, one gold ball, one teddy bear.

Hero Finds a Flower
If the hero encounters a flower, the hero picks it up. The hero should keep track of how many flowers the hero has encountered and picked up. There must be a method named checkForFlower in your Hero class.

Hero Finds a Gold Ball
If the hero encounters a gold ball, the hero picks it up. Picking up a gold ball causes another gold ball to appear somewhere else in the world at a random location. There must be a method named checkForGoldBall in your Hero class.

Hero Finds a Mushroom
Mushrooms disappear when the hero encounters them. If the hero encounters one mushroom, nothing happens in the program. If the hero encounters a second mushroom, the hero should turn into an animal (visually - that is, change the image) and the hero loses all the flowers he/she has been carrying around. The flowers go back into the world at random locations. If the hero encounters three mushrooms, Skull objects are added to the world at random locations. You should add three skulls to the world. There must be a method named checkForMushrooms in your Hero class.

Modify Behavior for Gold Ball
Picking up a gold ball also allows the hero's image to return to normal.

Hero Finds a Teddy Bear
When the hero encounters a teddy bear, the hero picks up the bear and all the skulls leave the world. If when picking up the bear, the hero has more than one flower, then another teddy bear will appear in the world. There must be a method named checkForTeddyBear in your Hero class.

Hero Encounters a Skull
If the hero encounters a skull, the scenario stops. There must be a method named checkForSkull in your Hero class.

This is what I've done so far

public class Hero extends Actor
{ 
/**
* Act - do whatever the Hero wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
private static final double WALKING_SPEED = 20;
private int _FlowersPicked;

public Hero() 
{
_FlowersPicked = 0; 
}
public boolean canSee(Class clss)
{
Actor actor = getOneObjectAtOffset(0, 0, clss);
return actor != null; 
}
public void act() 
{
// Add your action code here.
move();
checkForEdges();
turnRight();
turnLeft();
} 

public void move()
{ 
double angle = Math.toRadians( getRotation() );
int x = (int) Math.round(getX() + Math.cos(angle) * WALKING_SPEED);
int y = (int) Math.round(getY() + Math.sin(angle) * WALKING_SPEED);

setLocation(x, y);

}

public void turnRight()
{
if (Greenfoot.isKeyDown("right"))
{
setRotation(getRotation()+10);
}
}
public void turnLeft()
{
if (Greenfoot.isKeyDown("left"))
{
setRotation(getRotation()-10);
}
}

public void checkForEdges()
{
if(getX() == 0)
{
setLocation(getWorld().getWidth() - 1, getY());
}

if(getY() == 0)
{
setLocation(getX(),getWorld().getHeight(… - 1);
}
}


public void checkForFlower()
{
if(canSee(Flower.class))
{

_FlowersPicked = _FlowersPicked + 1;

}
}

public int getFlowersPicked() 
{
return _FlowersPicked;
}


}