Elements of a Greenfoot Scenario




World:
Where the action takes place. Where the action takes place. Similar to "Stage" in Scratch. To create a World you must:

  1. Right Click on "World" in Greenfoot and select "New subclass."
  2. Select a name and background for your World.
  3. Double Click the new World and define the size of the world grid and the size of the squares in the grid.

  4. Example:


  5. Click "Compile all" to bring the new World into existance.

Actors:
Actors are the characters, objects, and anything else that populates the World. Actors are like "Sprites" in Scratch. To create a new Actor do the following:

  1. Right click on Actor (or "Sprite" if you are using the spriteWorld template).
  2. Select "New subclass."
  3. Select a name and graphic for your new Actor.
  4. Click "Compile all."

To put an Actor in the world, you may right click on the new Actor and select "new Actor()" and put the new Actor onto the world. You may also define new Actors on the code for the World.

Example


public void act()
Any commands put into this method will run when the run icon is selected. This is similar to "When Green Flag Clicked" in Scratch. Methods run in act() will happen almost simultaneously (unlike Scratch which will run scripts in sequence.) Each Actor and the World may have their own "public void act()" sections.

Example

Email Mr.Michaud

Copyright ©2011 Mr. Michaud.