Kakihijau.googlepages.com Introduction To Greenfoot Part-2.

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
An Open-Source, Object-Oriented General Cartographic Transformation Program (GCTP) Michael S. Williams, Michael P. Finn*, and Robert A. Buehler** United.
COMPREHENSIVE Windows Tutorial 3 Personalizing Your Windows Environment.
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.
Research Development for Android Coopman Tom. What is Android?  Smartphone operating system  Google  Popular  ‘Easy to develop’  Open-Source  Linux.
CS 106 Introduction to Computer Science I 04 / 11 / 2008 Instructor: Michael Eckmann.
Wombats Creating Games with Greenfoot The Walker School – Games and Simulations
(C) 2010 Pearson Education, Inc. All rights reserved. Java™ How to Program, 8/e.
Chapter 1 - Getting to know Greenfoot Bruce Chittenden.
Chapter 1 - Getting to know Greenfoot Acknowledgement: Michael Kolling & Bruce Chittenden.
Movement. Fixed Movement setLocation (x, y) Makes the crab move to a fixed cell x,y Relative Movement The functions: getX() getY() Fetch the x and y coordinate.
Improving structure with inheritance
1 Introduction to Software Engineering Lecture 42 – Communication Skills.
Understanding class definitions Looking inside classes 3.0.
1 of 4 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Java Course Outline Kumar Harshit, USW. Course Description Teaches students to program using the Java programming language with the help of the Netbeans.
Analysis Modeling (cont’d) CpSc 372: Introduction to Software Engineering Jason O. Hallstrom Authorship Disclaimer. These slides.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
EDT Chapter 41 Coordinate Systems Cartesian, Relative and Polar Sacramento City College EDT 310.
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
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
Hunter Valley Amateur Beekeepers Forum User Guide Guide shows sample screenshots with most relevant actions. Website is at
CSE 113 Introduction to Computer Programming Lecture slides for Week 2 Wednesday, September 7 th, 2011 Instructor: Scott Settembre.
Improving structure with inheritance Main concepts to be covered Inheritance Subtyping Substitution Polymorphic variables Objects First with Java.
Object Oriented Programming April 13, Problem Description “ …Wombats are allowed to have different directions and number of eaten leaves, move,
Improving structure with inheritance Main concepts to be covered Inheritance Subtyping Substitution Polymorphic variables Objects First with Java.
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.
Object Oriented Software Development
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.
Final Review. From ArrayLists to Arrays The ArrayList : used to organize a list of objects –It is a class in the Java API –the ArrayList class uses an.
Lesson 2: Reading a program. Remember: from yesterday We learned about… Precise language is needed to program Actors and Classes Methods – step by step.
Introduction To Greenfoot
Find that place..  Find that content  Longitude, East is to the right, West is to the left of the Prime Meridian or 0 degrees  Latitude, North is going.
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.
Open Office Writer Introduction AOSS _ Course material AOSS Master training workshop Singapore 2007.
Page  1 Insert the title of your presentation here Enter your subtitle or main author‘s name here.
Kakihijau.googlepages.com Introduction To Greenfoot Part-3.
Sunken Treasure The Guessing Game for Treasure on the High Seas.
Introduction To Greenfoot
Introduction to Object-oriented Program Design
Creating Games with Greenfoot
The Racing Game of Knowledge
The Racing Game of Knowledge
Version 2.
Guess What’s Behind the Box
Insert Your Text Here.
Problem Solving with Data Structures using Java: A Multimedia Approach
Select from the most commonly used minutes below.
Object-Oriented Programming: Inheritance and Polymorphism
Blue Boat 1 Green Boat 2 Orange Boat 3 Purple Boat 4 Red Boat 5
Requirements for TGT Proposals
Methods, Data and Data Types
Greenfoot November 8, 2009.
Poul Henriksen Computing Laboratory University of Kent
Guess What’s Behind the Box
WJEC GCSE Computer Science
Extending Classes Through Inheritance
Presentation transcript:

kakihijau.googlepages.com Introduction To Greenfoot Part-2

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 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  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 (

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 3 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,

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 4 Outline  Class Display Revisited  Class Editor  The Leaf Class  The Wombat Class  The WombatWorld Class

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 5 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)

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 6 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“

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 7 Class Editor (2)

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 8 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

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 9 The Wombat Class (1) import necessary packages class header; Wombat is a subclass from Actor data (constants and variables) class constructor and methods

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 10 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()

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 11 The Wombat Class (3) constructor  initialising direction and leavesEaten this method is inherited from the superclass Actor is there any Leaf object in my position? remove that Leaf object update the variable leavesEaten

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 12 The Wombat Class (4)

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 13 The Wombat Class (5) this method is inherited from the superclass Actor

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 14 The Wombat Class (6) change direction 90 degrees to the left

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 15 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

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 16 The Wombat Class (8)

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 17 The Wombat Class (9) if object reaches one of the borders, do nothing! setLocation() is inherited from Actor the object moves forward; depends on its direction

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 18 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!

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 19 The WombatWorld Class (1)  1 constructor : WombatWorld()  2 methods : –populate() –randomLeaves()

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 20 The WombatWorld Class (2) calls the World constructor sets the background. the method is inherited from the superclass World cell.jpg

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 21 The WombatWorld Class (3)

Introduction to Greenfoot Eueung Mulyana | kakihijau.googlepages.com 22 The WombatWorld Class (4) Create a Leaf object at a random position (x,y); repeat howmany times