Greenfoot sound file types

broken image
broken image
broken image

Greenfoot.getRandomNumber(20) is different from the other methods we called before, it uses the dot notation.

broken image

Means that you want Greenfoot to pick a random number for you between 0 and 19. With greenfoot the highest number possible is actually one number less than the limit and the lowest number possible is zero. When you tell someone to pick a number between 1 and 10, you are setting the limit to 10 (they will probably pick 7 by the way). The method getRandomNumber has to have a parameter that tells it how high the number can go (the limit of the number). Greenfoot can come up with a random number for us with getRandomNumber. One way to do that with Greenfoot is by using random numbers. The crab should actually go more or less in a straight line, but every now and then it should turn off course a little bit. While it walks, it goes in a straight line. Right now, the crab can walk across the screen and then turn when it hits the edge. This makes Crab a subclass of an Actor subclass called Animal. First, load the scenario Animalcrab from the handout folder.

broken image