In the previous chapter, we discussed how to use existing Greenfoot scenarios: We have created
objects, invoked methods, and played a game.
Now, we shall start to make our own game.
2.1 The Little Crab scenario
The scenario we use for this chapter is called...
More
In the previous chapter, we discussed how to use existing Greenfoot scenarios: We have created
objects, invoked methods, and played a game.
Now, we shall start to make our own game.
2.1 The Little Crab scenario
The scenario we use for this chapter is called little-crab. You will find this scenario in the book
projects for this book.
The scenario you see should look similar to Figure 2.1.
CHAPTER
The first program: Little Crab
2
topics: writing code: movement, turning, reacting to the screen edges
concepts: source code, method call, parameter, sequence, if-statement
Exercise 2.1 Start Greenfoot and open the little-crab scenario. Place a crab into the
world and run the program (click the Run button). What do you observe? (Remember: If the
class icons on the right appear striped, you have to compile the project first.)
On the right, you see the classes in this scenario (Figure 2.2). We notice that there is the usual
Greenfoot Actor class, a class called Animal, and the Crab class.
The hie
Less