Introduction To Greenfoot

Slides:



Advertisements
Similar presentations
Problem Solving with Data Structures using Java: A Multimedia Approach Chapter 14: Using an Existing Simulation Package Download greenfoot and install.
Advertisements

Getting to know Greenfoot
of Kent A practical introduction to Greenfoot David Barnes Lecturer in Computer Science University of.
Chapter 2 - The First Program: Little Crab
Program: Little Crab Mr Gano.
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.
What is 5S; For Editable Slides Contact through Leanmanufacturingtools.org For Editable Slides Contact Through Leanmanufacturingtools.org.
Problem Solving with Data Structures using Java: A Multimedia Approach Chapter 14: Using an Existing Simulation Package.
Greenfoot. Getting Started Open the Greenfoot download site: Select Greenfoot
Chapter 1 - Getting to know Greenfoot
Guess What’s Behind the Box Next Slide Remove Box Next Slide.
Skip Intro Points Team One Team Two Team Three Team Four Team Five Team Six Team Seven Team Eight End Game.
Copyright © 2015 PoweryourPresentations.com. All rights reserved. South America Map Editable Template.
Lecture 4. Greenfoot 1 Pablo Romero, Department of Informatics Greenfoot Programming simulations and games in Java.
Greenfoot Game Programming Club.
Lesson 1: Writing a program. Java Java is a programming language Computer cannot understand it, though it can be translated ( compiled ) so a computer.
Kakihijau.googlepages.com Introduction To Greenfoot Part-1.
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.
Introduction To Greenfoot
Chapter 2 – The Little Crab Program:. Little Crab Scenario Inheritance: The Arrows Denote Hierarchy Crab is an Animal Animal is an Actor Therefore, It.
Object-Oriented Programming: Inheritance and Polymorphism.
Kakihijau.googlepages.com Introduction To Greenfoot Part-3.
1 How to manually package PO Lines Yoel Kortick Alma Global Support Manager.
Sunken Treasure The Guessing Game for Treasure on the High Seas.
Skip Intro It's Time to Play The Big Wheel.
Interlude 2 - The Greeps Competition
Introduction to SolidWorks
Guess What’s Behind the Box
Introduction to Object-oriented Program Design
Creating Games with Greenfoot
Skip Intro It's Time to Play The Big Wheel.
The Racing Game of Knowledge
Insert the title of your presentation here
The Racing Game of Knowledge
Version 2.
Guess What’s Behind the Box
Debugging with Eclipse
Insert the title of your presentation here
Insert the title of your presentation here
This presentation document has been prepared by Vault Intelligence Limited (“Vault") and is intended for off line demonstration, presentation and educational.
Insert the Title of your presentation here
Insert Your Text Here.
Problem Solving with Data Structures using Java: A Multimedia Approach
Insert the title of your presentation here
Select from the most commonly used minutes below.
Welcome To Big Board Facts.
For a Customized or Editable Version of This Presentation Contact Through Leanmanufacturingtools.org Runners Repeaters and Strangers, 5S; For Customized.
Object-Oriented Programming: Inheritance and Polymorphism
Instructions for the Teachers
Do you Dare Challenge The Great, All Knowing Robot Robie!
The Racing Game of Knowledge
Blue Boat 1 Green Boat 2 Orange Boat 3 Purple Boat 4 Red Boat 5
Insert the title of your presentation here
Insert the title of your presentation here
Methods, Data and Data Types
Greenfoot November 8, 2009.
APACHE LICENSE HISTORICAL EVOLUTION
Insert text here.. Insert text here. BONUS! +2.
Insert the title of your presentation here
Poul Henriksen Computing Laboratory University of Kent
Insert text here. Insert text here BONUS Insert text here.
Guess What’s Behind the Box
WJEC GCSE Computer Science
Extending Classes Through Inheritance
Debugging with Eclipse
Bishopston Comprehensive School
Presentation transcript:

Introduction To Greenfoot Part-2

Disclaimer This document is intended to give a beginner an introductory material for the Greenfoot system. Greenfoot is a software framework made by Poul Henriksen and Michael Koelling at University of Kent / Deakin University. More information can be found at http://www.greenfoot.org This document is available „AS IS“ free of charge for personal use and non-commercial redistribution. It may not be sold for profit or included in other packages which are sold for profit without written authorisation. This document is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; your use of the document is at your sole risk. Reusing and modifying (part of) this document is allowed, as long as you state explicitly that your work is based on the original document produced by the copyright holder: Eueung Mulyana. The author can be contacted via eueung-[at]-yahoo.com (http://kakihijau.googlepages.com).

Purpose This is the second part of the document „Introduction to Greenfoot“ and focuses on understanding the wombats scenario Part of the content of these slides is based on the Greenfoot Tutorial made by Michael Koelling, publicly accesible at the Greenfoot website, http://www.greenfoot.org

Outline Class Display Revisited Class Editor The Leaf Class The Wombat Class The WombatWorld Class

Class Display Revisited Class display contains all classes which are used in a scenario Class World and Actor are abstract superclasses, part of the Greenfoot system Scenario wombats has 2 actor classes (Wombat, Leaf)

Class Editor (1) We can modify objects behaviour by editing the source code of the corresponding class To display the source code editor: Double-click the class Right-click the class, choose the item „Open editor“

Class Editor (2)

The Leaf Class The simplest class compared to the Wombat and WombatWorld class Leaf objects do nothing! As you can see in the previous slide, the Leaf class has no statement and consists of an empty constructor

The Wombat Class (1) import necessary packages class header; Wombat is a subclass from Actor data (constants and variables) class constructor and methods

The Wombat Class (2) 4 constants : EAST, WEST, NORTH, SOUTH 2 variables : direction, leavesEaten 1 constructor : Wombat() 8 methods : getLeavesEaten(), foundLeaf(), eatLeaf() setDirection(), turnLeft() canMove(), move() act()

The Wombat Class (3) constructor  initialising direction and leavesEaten is there any Leaf object in my position? this method is inherited from the superclass Actor remove that Leaf object update the variable leavesEaten

The Wombat Class (4)

The Wombat Class (5) this method is inherited from the superclass Actor

The Wombat Class (6) change direction 90 degrees to the left

The Wombat Class (7) these methods are inherited from Actor new coordinate if the object moves forward; depends on its direction checks if the object reaches the edges of the world

The Wombat Class (8)

The Wombat Class (9) if object reaches one of the borders, do nothing! the object moves forward; depends on its direction setLocation() is inherited from Actor

The Wombat Class (10) if you find leaves, eat ! if you don‘t find leaves, but you can move forward, then move! if you don‘t find leaves and you also cannot move, then turn to the left!

The WombatWorld Class (1) 1 constructor : WombatWorld() 2 methods : populate() randomLeaves()

The WombatWorld Class (2) calls the World constructor sets the background. the method is inherited from the superclass World cell.jpg

The WombatWorld Class (3)

The WombatWorld Class (4) Create a Leaf object at a random position (x,y); repeat howmany times