Introduction to greenfoot
This presentation is the property of its rightful owner.
Sponsored Links
1 / 17

Introduction To Greenfoot PowerPoint PPT Presentation


  • 164 Views
  • Uploaded on
  • Presentation posted in: General

Introduction To Greenfoot. What is Greenfoot? Greenfoot: is an Integrated Development Environment. (Remember, an IDE is a program that lets you create other programs) uses the Java Programming Language. is aimed at creating 2D graphical applications. Greenfoot is great for creating:

Download Presentation

Introduction To Greenfoot

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Introduction to greenfoot

Introduction ToGreenfoot


Introduction to greenfoot

  • What is Greenfoot?

  • Greenfoot:

    • is an Integrated Development Environment.

      • (Remember, an IDE is a program that lets you create other programs)

    • uses the Java Programming Language.

    • is aimed at creating 2D graphical applications.


Introduction to greenfoot

  • Greenfoot is great for creating:

    • Games (biomekanoidchicken)

    • Applications

    • Simulations (ants)


Introduction to greenfoot

  • In Greenfoot, programs and applications are called “Scenarios.”

  • To open a Scenario:

    • Open Greenfoot

    • Scenario  Open Scenario

    • Find the Greenfoot Folder  Find the Scenario folder  Look for this icon:


Introduction to greenfoot

  • Greenfoot uses 2 superclasses:

    • 1. World – The instance of this class becomes the world in which the actor objects do things.

    • 2. Actor – This class contains data properties and methods that allow for actor objects to exist in the instance of the world class.

    • (We will learn more about super and sub classes later…)


The greenfoot ide

The Greenfoot IDE

Class

Diagrams

World Object

Actor Object


Introduction to greenfoot

  • Compiling classes:

If a class is striped, it needs to be compiled.


Introduction to greenfoot

You can right-click a class, to see its constructor.

Select the constructor, and then you can add an instance of the class to the world.

  • 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.


Introduction to greenfoot

  • Running the World:

The Run button simply calls the Act method over and over again.

The Act button calls the Act Method. The objects in the world will do whatever they are programmed to do.

The speed at which the Run button calls the act method can be altered here.


Introduction to greenfoot

  • To see an object’s methods:

    • Right-Click an object in the world.

    • You can also execute those methods.

    • This is great for interactive testing.


Introduction to greenfoot

  • To alter the code for a class:

    • Double-click the class. This opens the BluJ editor.

    • Change the code.

    • Save or Compile!


Introduction to greenfoot

  • Question:

    • Does the Crab class from the demo have a move( ) method defined in it?


Introduction to greenfoot

  • There is no move( ) method in the Crab class. So where is that method coming from?

  • Notice how the Crab class from the demo has a class above it named Animal.

  • The Crab class has access to ALL of the Animal class’ methods.


Introduction to greenfoot

  • Here is the move( ) method in the code from the Animal class:

  • This Crab class uses the Animal class’ move( ) method to move in the world.

  • We will learn more about this later….


Introduction to greenfoot

  • Code that you used today:

    move( ); //This moves the object forward.

    turn(-12); //This turns the object -12 degrees

    if(Greenfoot.isKeyDown(“left”))

    {

    turn(12);

    } //This code turns the object whenever the left key is pressed down.


Introduction to greenfoot

  • Opening Greenfoot Projects from www.classofcrow.com:

    • Mister Crow will be giving you incomplete Greenfoot projects (for now).

    • These will usually be found on the website in a zipped format.

    • “Zipped” means that a folder with files is compressed and zipped into ONE file.

    • You have to have a program like 7-zip to UNZIP those files. 7-Zip is free and it is already loaded on our computers.

    • Download the file  Right-click on it

    • Select “7-Zip”  Select “Extract Here”  The files and folder will be unzipped.


Introduction to greenfoot

  • Saving Greenfoot Projects for grading:

    • When you are finished with your project go to:

    • Scenario  “Save a copy as”

    • Name the folder:

      crow(period)_(ProjectNumber)_(LastNameFirstInitial)

    • For Example:

      crow3_121_SmithJ

    • This folder will go in the CLASS folder on the due date.


  • Login