This Crab class uses the Animal class’ move( ) method to move in the world. The Crab class has access to ALL of the Animal class’ methods.ġ4 Here is the move( ) method in the code from the Animal class: So where is that method coming from? Notice how the Crab class from the demo has a class above it named Animal. There is no move( ) method in the Crab class. Save or Compile!ġ2 Question: Does the Crab class from the demo have a move( ) method defined in it?ġ3 There is no move( ) method in the Crab class This is great for interactive testing.ĭouble-click the class. The speed at which the Run button calls the act method can be altered here. The objects in the world will do whatever they are programmed to do. Running the World: The Run button simply calls the Act method over and over again. Adding objects to the world: Shift-Click: Another way of adding objects is to click on the class, press shift, and click in the world.ĩ The Run button simply calls the Act method over and over again. Select the constructor, and then you can add an instance of the class to the world. (We will learn more about super and sub classes later…)Ħ The Greenfoot IDE Class Diagrams World Object Actor Objectħ If a class is striped, it needs to be compiled.Ĭompiling classes: If a class is striped, it needs to be compiled.Ĩ You can right-click a class, to see its constructor. Actor – This class contains data properties and methods that allow for actor objects to exist in the instance of the world class. World – The instance of this class becomes the world in which the actor objects do things. To open a Scenario: Open Greenfoot Scenario Open Scenario Find the Greenfoot Folder Find the Scenario folder Look for this icon:ġ. Games (biomekanoidchicken) Applications Simulations (ants)Ĥ In Greenfoot, programs and applications are called “Scenarios.” is aimed at creating 2D graphical applications. (Remember, an IDE is a program that lets you create other programs) uses the Java Programming Language. Is an Integrated Development Environment.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |