Greenfoot. Getting Started Open the Greenfoot download site: Select Greenfoot 2.0.1.

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

Problem Solving with Data Structures using Java: A Multimedia Approach Chapter 14: Using an Existing Simulation Package Download greenfoot and install.
Getting to know Greenfoot
 Use the Left and Right arrow keys or the Page Up and Page Down keys to move between the pages. You can also click on the pages to move forward.  To.
Chapter 2 - The First Program: Little Crab
Program: Little Crab Mr Gano.
Asteroids Games and Simulations O-O Programming in Java The Walker School The Walker School – Games and Simulations
Greenfoot Asteroids Mrs. C. Furman August 16, 2010.
Wombats Creating Games with Greenfoot The Walker School – Games and Simulations
Chapter 1 - Getting to know Greenfoot Bruce Chittenden.
Chapter 1 - Getting to know Greenfoot Acknowledgement: Michael Kolling & Bruce Chittenden.
Java Programming Working with TextPad. Using TextPad to Work with Java This text editor is designed for working with Java You can download a trial version.
Command Console Tutorial BCIS 3680 Enterprise Programming.
01-Intro-Object-Oriented-Prog-Alice1 Barb Ericson Georgia Institute of Technology Aug 2009 Introduction to Object-Oriented Programming in Alice.
Installing the Core FTP Client Go to Click on “Download Core FTP now!” Under the Core FTP LE 2.2: free version heading Select.
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
1 CSC 221: Computer Programming I Fall 2004 Objects and classes: a first pass  software objects, classes, object-oriented design  BlueJ IDE, compilation.
Created by NW 2012 – please note all copyright on images used is property of copyright holder. Note: some of the more complicated descriptions are taken.
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
1 CSC 221: Computer Programming I Spring 2010 Objects and classes: a broad view  Scratch programming review  object-oriented design, software objects.
SUSE Linux Enterprise Desktop Administration Chapter 2 Use the Linux Desktop.
Lesson 1 Windows 7. Windows 7 is an operating system. The main screen is called the Windows Desktop.
POS 406 Java Technology And Beginning Java Code
Chapter 1 - Getting to know Greenfoot
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
Copyright © Curt Hill Turtles The beginning of media computation.
CMPS 1371 Introduction to Computing for Engineers MatLab.
BIT 285: ( Web) Application Programming Lecture 18: Thursday, March 5, 2015 REST Creating a REST API Instructor: Craig Duckett.
Lecture 4. Greenfoot 1 Pablo Romero, Department of Informatics Greenfoot Programming simulations and games in Java.
1 CSC 221: Computer Programming I Spring 2008 Objects and classes: a broad view  software objects, classes, object-oriented design  BlueJ IDE, compilation.
EIE375 BlueJ: Getting Started Dr Lawrence Cheung.
Creating Greenfoot Backgrounds. GIMP: GIMP: is a software graphics editor is a software graphics editor is similar to Adobe Photoshop – but FREE. is similar.
Greenfoot Game Programming Club.
1 Getting Started with C++. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Visual Studio 2008.
Intro to Programming Environment 1. Today You Will Learn how to connect to a machine remotely with “nomachine NX client” Learn how to create a new “source.
Java Programming, Second Edition Appendix A Working with Java SDK 1.4.
Lesson 1: Writing a program. Java Java is a programming language Computer cannot understand it, though it can be translated ( compiled ) so a computer.
Advanced Stuff Learning by example: Responding to the mouse.
Kakihijau.googlepages.com Introduction To Greenfoot Part-1.
Creating Shortcuts On the Desktop. Creating Shortcuts to programs Many programs create their own desktop shortcuts when installed. A desktop icon with.
Lesson 2: Reading a program. Remember: from yesterday We learned about… Precise language is needed to program Actors and Classes Methods – step by step.
Kakihijau.googlepages.com Introduction To Greenfoot Part-2.
, Bauru, Teacher Poly & Teacher Ulisses Audio Class!
Compiling and running Java programs with BlueJ. Successfully compiled files program files in BlueJ You can tell from the shade of a program icon in BlueJ.
1 Class 1 Lecture Topic Concepts, Definitions and Examples.
Introduction To Greenfoot
1 CSC 221: Computer Programming I Fall 2009 Objects and classes: a broad view  Scratch programming review  object-oriented design, software objects 
Photoshop Actions Lights, Camera, Actions in Photoshop.
1 Getting Started with C++ Part 1 Windows. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Microsoft.
Chapter 2 – The Little Crab Program:. Little Crab Scenario Inheritance: The Arrows Denote Hierarchy Crab is an Animal Animal is an Actor Therefore, It.
1.1: Objects and Classes msklug.weebly.com. Agenda: Attendance Let’s get started What is Java? Work Time.
Kakihijau.googlepages.com Introduction To Greenfoot Part-3.
Newton’s Lab Games and Simulations O-O Programming in Java.
WINDOWS 7 Windows 7 is an operating system that Microsoft has produced for use on personal computers. It is the follow-up to the Windows Vista Operating.
Introducing Scratch Learning resources for the implementation of the scenario
1 Development Environments AUBG, COS dept Lecture Title: Dev Env: BlueJ (Extract from Syllabus) Reference:
Downloading & Installing the BIT115 Software & Programs
Chapter 4 - Finishing the Crab Game
Chapter 3 – Improving the Crab Game
Introduction To Greenfoot
Creating Games with Greenfoot
Games and Simulations O-O Programming in Java The Walker School
Download and Installation of code::blocks
Introduction to Object-Oriented Programming in Alice
Methods, Data and Data Types
Greenfoot November 8, 2009.
1.7 A Second Example.
Bishopston Comprehensive School
Presentation transcript:

Greenfoot

Getting Started Open the Greenfoot download site: Select Greenfoot “For other systems (executable jar file).” Download the.jar file to your Desktop. You can also download Greenfoot to your personal computer, but Java™ is a prerequisite.

Installing Greenfoot Open a terminal window and type the command below to change to your Desktop directory : cd Desktop Run the installer by typing the following command in your terminal window: java -jar Greenfoot-generic-201.jar (you must be in your Desktop directory)

The Installer Accept the default directories in the installer pop-up window. Complete the installation. The installer will install Greenfoot in your Desktop directory.

Running Greenfoot To run Greenfoot, simply type the following command in the terminal window: greenfoot/greenfoot (you must be in your Desktop directory) Choose this one

Cleanup Move the.jar file to the trash Empty the trash

What is Greenfoot? Who developed it? “Greenfoot supports development of graphical applications in the Java™ Programming Language.” “Greenfoot was designed and implemented at the University of Kent, England, and Deakin University, Melbourne, Australia.”

First Look You should see something similar to what is displayed as a background to this slide.

Getting Started World Class Diagram Execution Controls

Objects and Classes Right Click on Wombat Click New Wombat() Drag to World

Populate the world Press Run to run the simulation

Interacting with Objects Invoke the Move method Right Click on the Wombat

Return values

Parameters

Directions

Invoking wombatWorld Methods right-click the WombatWorld class and select ‘ new WombatWorld() ’. What happens? What type of function is WombatWorld()? How did you know that? right-click in the world “grid” –Try populate(). –Try randomLeaves(int howMany).

Change the Scenario Asteroids scenario

Understanding the Class Diagram World Class is always there in Greenfoot scenarios, it is built-in. Space represents a specific world for this scenario Arrows show relationships Explosion and Mover are subclasses of Actor Bullet, Rocket, and Asteroid are subclasses of Mover. Vector is a helper class

Inspect Right Click on an Object and Select Inspect Create a few objects

Inspect Right Click on the Object and Select Inspect

Editing Code Change back to the Wombat scenario Right-click on the Wombat class icon and select “Open editor”

Changing the Wombat Class Add the following method to the Wombat class: public void turnRandom() { // get a random number between 0 and 3... int turns = Greenfoot.getRandomNumber(4); //...an turn left that many times. for(int i=0; i<turns; i++) { turnLeft(); }

Change act() public void act() { if(foundLeaf()) { eatLeaf(); } else if(canMove()) { move(); } else { turnRandom(); // change turnLeft(); to turnRandom(); }

Compile Before you can execute your class changes you must compile your project. –Compile within the editor, or –Compile from Greenfoot’s main window. Once you have successfully compiled, you can create objects again. –Compilation (if successful) automatically instantiates a world object.

Changing Images 2 ways to change the image of objects –Change the image of a class, changing the image for all objects of that class. Select ‘Set Image...’ from the class’s pop-up menu. –Change the image of a object, changing only the individual object. Objects can change images as often as desired Call the ‘setImage’ method inherited from Actor. –one version of setImage() has a parameter of type GreenfootImage –one version of setImage() takes a String that is the name of an image file.

Documentation To make changes to object behavior, you often need to make use of some standard Greenfoot classes. Greenfoot provides four important classes that you should know about: 1.World 2.Actor 3.GreenfootImage 4.Greenfoot. Greenfoot’s online documentation: Video tutorials

In Class Activity If there isn’t one, create a Rock class---it doesn’t need to do anything. Modify wombatWorld’s populate() to initialize the world with 2 rocks, 3 wombat and 7 leaves to the wombatWorld. Run the simulation and notice that the wombats walk through the rocks. Modify the Wombat class so that it can’t walk through rocks. (BIG HINT: look at the Wombat2 scenario for a solution.)