SlideShare una empresa de Scribd logo
1 de 26
Introduction To
                            Greenfoot
                               Part-1


kakihijau.googlepages.com
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).


                                                     Introduction to Greenfoot              2
                                               Eueung Mulyana | kakihijau.googlepages.com
Introduction
 „Greenfoot is a software tool designed to let beginners
  get experience with object-oriented programming. It
  supports development of graphical applications in the
  Java™ Programming Language“
 Designed and implemented at the University of Kent and
  Deakin University
 Copyright held by Poul Henriksen and Michael Koelling
 More information at http://www.greenfoot.org

 Part of the content of these slides is based on the
  Greenfoot Tutorial made by Michael Koelling,
  publicly accesible at the website


                                              Introduction to Greenfoot              3
                                        Eueung Mulyana | kakihijau.googlepages.com
Outline
   Visual Interface
   Creating Objects
   Interaction with Objects
   Removing Objects
   Objects‘ Action
   Simulation „Run“
   Scenario plane
   Scenario turtleGraphics
   Scenario ants
   Scenario lunarlander


                                      Introduction to Greenfoot              4
                                Eueung Mulyana | kakihijau.googlepages.com
Visual Interface (scenario wombats)




                            Introduction to Greenfoot              5
                      Eueung Mulyana | kakihijau.googlepages.com
Visual Interface
 Consists of 3 main parts

 The world
   – The large canvas that covers the majority of the window
   – Has a title e.g. WombatWorld
   – The enviroment („the world“) where objects exist
 Class display
   – Contains all Java classes involved in the scenario
   – 3 groups: World, Actor and other classes
 Execution controls
   – Controls the action of each object: the „Act“ button
   – Controls simulation: „Run“, „Pause“, slider
   – Resets the scenario

                                                    Introduction to Greenfoot              6
                                              Eueung Mulyana | kakihijau.googlepages.com
Creating Objects (1)




 (Left-)Click on the Wombat or Leaf class to make it
  active

 To create and place an object into the world :
   – Activate a class then shift+click somewhere in the World
   – Right-click a class (e.g. Wombat class) to open the class context
     menu, select the „New Wombat()“ item then click somewhere in
     the World

                                                    Introduction to Greenfoot              7
                                              Eueung Mulyana | kakihijau.googlepages.com
Creating Objects (2)




Creating 3 objects and placing             Class
     them into the World               context menu


                                       Introduction to Greenfoot              8
                                 Eueung Mulyana | kakihijau.googlepages.com
Interaction with Objects (1)
                          Methods of an object
                           can directly be invoked
                          „A method is a single
                           action that an object
                           can perform“
                          Right-click on one
                           object to show its
                           (object) context menu,
                           where you can select a
                           method to ask the
                           object to do
                           „something“


   turnleft()   move()            Introduction to Greenfoot              9
                            Eueung Mulyana | kakihijau.googlepages.com
Interaction with Objects (2)

 The world where the wombats live
  (WombatWorld) is actually an
  object, too
 But there may exist only one World
  object at a time
 It functions as a container for Actor
  objects (e.g. Wombat, Leaf etc.)

 Single method invocation is still
  possible for the World object; just
  right-click the title „WombatWorld“
  and select a method from the menu


                                                Introduction to Greenfoot              10
                                          Eueung Mulyana | kakihijau.googlepages.com
Interaction with Objects (3)




populate()         randomLeaves()
                         Introduction to Greenfoot              11
                   Eueung Mulyana | kakihijau.googlepages.com
Interaction with Objects (4)
 A method may have one or more parameters
 You will be requested to give value(s) of the parameter(s)
  when you invoke such a method
 Try the method setDirection() from a Wombat object
  or the method randomLeaves() from the
  WombatWorld

 A method may also return one value (or reference to an
  object) if it is invoked
 Try foundLeaf() or getLeavesEaten() from a Wombat
  object


                                             Introduction to Greenfoot              12
                                       Eueung Mulyana | kakihijau.googlepages.com
Removing Objects (1)
 An object can be removed by selecting item „Remove“
  from the object context menu

 Clicking the „Reset“ button or creating a new World
  object from the class context menu may remove all
  objects; however it actually depends on the constructor
  implementation of the World class  (*)




                                           Introduction to Greenfoot              13
                                     Eueung Mulyana | kakihijau.googlepages.com
Removing Objects (2)




                     Introduction to Greenfoot              14
               Eueung Mulyana | kakihijau.googlepages.com
Objects‘ Action
 Each Actor object has a special method called act()
 Pressing the button „Act“ on the control panel means
  asking Greenfoot to execute act() method for all objects
  in the world

 An object acts by doing „whatever it wants to do“ e.g.:
   – Wombats move forward, if they find a leaf in their path, they will
     eat it
   – Leaves do nothing
 The action depends actually on how act() method is
  defined; that is, we can program object behaviors!!


                                                    Introduction to Greenfoot              15
                                              Eueung Mulyana | kakihijau.googlepages.com
Simulation „Run“
 A scenario can be run by clicking the „Run“ button
 This equivalent to clicking the „Act“ button over and over
  again very quickly
 The slider next to the „Act“ and „Run“ buttons sets the
  „running/simulation“ speed

 Make an experiment with scenario wombats
   – Click „Reset“ if you have already some objects
   – Select Populate() from the WombatWorld menu
   – Click „Run“




                                                  Introduction to Greenfoot              16
                                            Eueung Mulyana | kakihijau.googlepages.com
Simulation „Run“




 Running wombats scenario
                           Introduction to Greenfoot              17
                     Eueung Mulyana | kakihijau.googlepages.com
Scenario plane (1)
 Choose „Open ...“ from the „Scenario“
  menu and select the plane scenario
  from the Greenfoot sample scenarios
 Press the „Compile all“ button, if
  necessary
 Instantiate a Plane object and place
  somewhere in the world
 Run the scenario by pressing „Run“
 Try to drag the ControlKnob object
  and observe the result



                                            Introduction to Greenfoot              18
                                      Eueung Mulyana | kakihijau.googlepages.com
Scenario plane (2)




                    Introduction to Greenfoot              19
              Eueung Mulyana | kakihijau.googlepages.com
Scenario plane (3)




                    Introduction to Greenfoot              20
              Eueung Mulyana | kakihijau.googlepages.com
Scenario turtleGraphics (1)
 Choose „Open ...“ from the „Scenario“ menu and select
  the turtleGraphics scenario from the Greenfoot sample
  scenarios
 Press the „Compile all“ button, if necessary
 Instantiate several turtle objects (CircleTurtle,
  SquareTurtle, FlowerTurtle and SpiralTurtle) and
  place somewhere in the world
 Run the scenario by pressing „Run“
 Observe the result




                                          Introduction to Greenfoot              21
                                    Eueung Mulyana | kakihijau.googlepages.com
Scenario turtleGraphics (2)




                         Introduction to Greenfoot              22
                   Eueung Mulyana | kakihijau.googlepages.com
Scenario ants (1)
 Choose „Open ...“ from the „Scenario“ menu and select
  the ants scenario from the Greenfoot sample scenarios
 Press the „Compile all“ button, if necessary
 By default (standard Greenfoot 1.3 distribution) you will
  have several objects, which are actually formed together
  as the World object is created; these objects are instances
  of the class AntHill and Food; other objects will be
  created „on-the-fly“
 Run the scenario by pressing „Run“
 Observe the result



                                              Introduction to Greenfoot              23
                                        Eueung Mulyana | kakihijau.googlepages.com
Scenario ants (2)




                    Introduction to Greenfoot              24
              Eueung Mulyana | kakihijau.googlepages.com
Scenario lunarlander (1)
 Choose „Open ...“ from the „Scenario“ menu and select
  the lunarlander scenario from the Greenfoot sample
  scenarios
 Press the „Compile all“ button, if necessary
 By default you will have a Lander object, which is
  actually formed together as the World object is created
 Now you are ready to play the game; run the scenario by
  pressing „Run“
 The rocket thrust can be controlled by pressing the
  „down“ key on the keyboard



                                            Introduction to Greenfoot              25
                                      Eueung Mulyana | kakihijau.googlepages.com
Scenario lunarlander (2)




                       Introduction to Greenfoot              26
                 Eueung Mulyana | kakihijau.googlepages.com

Más contenido relacionado

La actualidad más candente

Two dimensional viewing
Two dimensional viewingTwo dimensional viewing
Two dimensional viewingMohd Arif
 
Convolutional neural network
Convolutional neural networkConvolutional neural network
Convolutional neural networkItachi SK
 
Principal Component Analysis PCA
Principal Component Analysis PCAPrincipal Component Analysis PCA
Principal Component Analysis PCAAbdullah al Mamun
 
Computer graphics presentation
Computer graphics presentationComputer graphics presentation
Computer graphics presentationLOKENDRA PRAJAPATI
 
Lec02 03 rasterization
Lec02 03 rasterizationLec02 03 rasterization
Lec02 03 rasterizationMaaz Rizwan
 
Image processing presentataion
Image processing presentataionImage processing presentataion
Image processing presentataionRafi Ullah
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesAnkit Garg
 
Fuzzy c-means clustering for image segmentation
Fuzzy c-means  clustering for image segmentationFuzzy c-means  clustering for image segmentation
Fuzzy c-means clustering for image segmentationDharmesh Patel
 
Image enhancement
Image enhancementImage enhancement
Image enhancementKuppusamy P
 
Data Reduction Stratergies
Data Reduction StratergiesData Reduction Stratergies
Data Reduction StratergiesAnjaliSoorej
 
Clustering, k-means clustering
Clustering, k-means clusteringClustering, k-means clustering
Clustering, k-means clusteringMegha Sharma
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clippingMdAlAmin187
 
Color fundamentals and color models - Digital Image Processing
Color fundamentals and color models - Digital Image ProcessingColor fundamentals and color models - Digital Image Processing
Color fundamentals and color models - Digital Image ProcessingAmna
 

La actualidad más candente (20)

Video display devices
Video display devicesVideo display devices
Video display devices
 
Two dimensional viewing
Two dimensional viewingTwo dimensional viewing
Two dimensional viewing
 
Convolutional neural network
Convolutional neural networkConvolutional neural network
Convolutional neural network
 
Principal Component Analysis PCA
Principal Component Analysis PCAPrincipal Component Analysis PCA
Principal Component Analysis PCA
 
Computer graphics presentation
Computer graphics presentationComputer graphics presentation
Computer graphics presentation
 
Lec02 03 rasterization
Lec02 03 rasterizationLec02 03 rasterization
Lec02 03 rasterization
 
Image processing presentataion
Image processing presentataionImage processing presentataion
Image processing presentataion
 
Python Programming Essentials - M12 - Lists
Python Programming Essentials - M12 - ListsPython Programming Essentials - M12 - Lists
Python Programming Essentials - M12 - Lists
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
 
Fuzzy c-means clustering for image segmentation
Fuzzy c-means  clustering for image segmentationFuzzy c-means  clustering for image segmentation
Fuzzy c-means clustering for image segmentation
 
Frame buffer
Frame bufferFrame buffer
Frame buffer
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Data Reduction Stratergies
Data Reduction StratergiesData Reduction Stratergies
Data Reduction Stratergies
 
Segmentation Techniques -I
Segmentation Techniques -ISegmentation Techniques -I
Segmentation Techniques -I
 
Clustering, k-means clustering
Clustering, k-means clusteringClustering, k-means clustering
Clustering, k-means clustering
 
lecture2 computer graphics graphics hardware(Computer graphics tutorials)
 lecture2  computer graphics graphics hardware(Computer graphics tutorials) lecture2  computer graphics graphics hardware(Computer graphics tutorials)
lecture2 computer graphics graphics hardware(Computer graphics tutorials)
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
 
Halftoning in Computer Graphics
Halftoning  in Computer GraphicsHalftoning  in Computer Graphics
Halftoning in Computer Graphics
 
Color fundamentals and color models - Digital Image Processing
Color fundamentals and color models - Digital Image ProcessingColor fundamentals and color models - Digital Image Processing
Color fundamentals and color models - Digital Image Processing
 
Vfx Terminologies with Examples
Vfx Terminologies with ExamplesVfx Terminologies with Examples
Vfx Terminologies with Examples
 

Más de Eueung Mulyana

Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveHyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveEueung Mulyana
 
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldIndustry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldEueung Mulyana
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain IntroductionEueung Mulyana
 
Bringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachBringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachEueung Mulyana
 
FinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionFinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionEueung Mulyana
 
Open Source Networking Overview
Open Source Networking OverviewOpen Source Networking Overview
Open Source Networking OverviewEueung Mulyana
 
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments Eueung Mulyana
 
Open stack pike-devstack-tutorial
Open stack pike-devstack-tutorialOpen stack pike-devstack-tutorial
Open stack pike-devstack-tutorialEueung Mulyana
 
ONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionEueung Mulyana
 
OpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionOpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionEueung Mulyana
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming BasicsEueung Mulyana
 
Cloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesCloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesEueung Mulyana
 
selected input/output - sensors and actuators
selected input/output - sensors and actuatorsselected input/output - sensors and actuators
selected input/output - sensors and actuatorsEueung Mulyana
 
Connected Things, IoT and 5G
Connected Things, IoT and 5GConnected Things, IoT and 5G
Connected Things, IoT and 5GEueung Mulyana
 
Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+Eueung Mulyana
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseEueung Mulyana
 
Trends and Enablers - Connected Services and Cloud Computing
Trends and Enablers  - Connected Services and Cloud ComputingTrends and Enablers  - Connected Services and Cloud Computing
Trends and Enablers - Connected Services and Cloud ComputingEueung Mulyana
 

Más de Eueung Mulyana (20)

FGD Big Data
FGD Big DataFGD Big Data
FGD Big Data
 
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveHyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
 
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldIndustry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain Introduction
 
Bringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachBringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based Approach
 
FinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionFinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency Introduction
 
Open Source Networking Overview
Open Source Networking OverviewOpen Source Networking Overview
Open Source Networking Overview
 
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments
 
Open stack pike-devstack-tutorial
Open stack pike-devstack-tutorialOpen stack pike-devstack-tutorial
Open stack pike-devstack-tutorial
 
Basic onos-tutorial
Basic onos-tutorialBasic onos-tutorial
Basic onos-tutorial
 
ONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionONOS SDN Controller - Introduction
ONOS SDN Controller - Introduction
 
OpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionOpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - Introduction
 
Mininet Basics
Mininet BasicsMininet Basics
Mininet Basics
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming Basics
 
Cloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesCloud Computing: Overview and Examples
Cloud Computing: Overview and Examples
 
selected input/output - sensors and actuators
selected input/output - sensors and actuatorsselected input/output - sensors and actuators
selected input/output - sensors and actuators
 
Connected Things, IoT and 5G
Connected Things, IoT and 5GConnected Things, IoT and 5G
Connected Things, IoT and 5G
 
Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and Firebase
 
Trends and Enablers - Connected Services and Cloud Computing
Trends and Enablers  - Connected Services and Cloud ComputingTrends and Enablers  - Connected Services and Cloud Computing
Trends and Enablers - Connected Services and Cloud Computing
 

Último

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 

Último (20)

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 

Greenfoot Introduction (1)

  • 1. Introduction To Greenfoot Part-1 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 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). Introduction to Greenfoot 2 Eueung Mulyana | kakihijau.googlepages.com
  • 3. Introduction  „Greenfoot is a software tool designed to let beginners get experience with object-oriented programming. It supports development of graphical applications in the Java™ Programming Language“  Designed and implemented at the University of Kent and Deakin University  Copyright held by Poul Henriksen and Michael Koelling  More information at http://www.greenfoot.org  Part of the content of these slides is based on the Greenfoot Tutorial made by Michael Koelling, publicly accesible at the website Introduction to Greenfoot 3 Eueung Mulyana | kakihijau.googlepages.com
  • 4. Outline  Visual Interface  Creating Objects  Interaction with Objects  Removing Objects  Objects‘ Action  Simulation „Run“  Scenario plane  Scenario turtleGraphics  Scenario ants  Scenario lunarlander Introduction to Greenfoot 4 Eueung Mulyana | kakihijau.googlepages.com
  • 5. Visual Interface (scenario wombats) Introduction to Greenfoot 5 Eueung Mulyana | kakihijau.googlepages.com
  • 6. Visual Interface  Consists of 3 main parts  The world – The large canvas that covers the majority of the window – Has a title e.g. WombatWorld – The enviroment („the world“) where objects exist  Class display – Contains all Java classes involved in the scenario – 3 groups: World, Actor and other classes  Execution controls – Controls the action of each object: the „Act“ button – Controls simulation: „Run“, „Pause“, slider – Resets the scenario Introduction to Greenfoot 6 Eueung Mulyana | kakihijau.googlepages.com
  • 7. Creating Objects (1)  (Left-)Click on the Wombat or Leaf class to make it active  To create and place an object into the world : – Activate a class then shift+click somewhere in the World – Right-click a class (e.g. Wombat class) to open the class context menu, select the „New Wombat()“ item then click somewhere in the World Introduction to Greenfoot 7 Eueung Mulyana | kakihijau.googlepages.com
  • 8. Creating Objects (2) Creating 3 objects and placing Class them into the World context menu Introduction to Greenfoot 8 Eueung Mulyana | kakihijau.googlepages.com
  • 9. Interaction with Objects (1)  Methods of an object can directly be invoked  „A method is a single action that an object can perform“  Right-click on one object to show its (object) context menu, where you can select a method to ask the object to do „something“ turnleft() move() Introduction to Greenfoot 9 Eueung Mulyana | kakihijau.googlepages.com
  • 10. Interaction with Objects (2)  The world where the wombats live (WombatWorld) is actually an object, too  But there may exist only one World object at a time  It functions as a container for Actor objects (e.g. Wombat, Leaf etc.)  Single method invocation is still possible for the World object; just right-click the title „WombatWorld“ and select a method from the menu Introduction to Greenfoot 10 Eueung Mulyana | kakihijau.googlepages.com
  • 11. Interaction with Objects (3) populate() randomLeaves() Introduction to Greenfoot 11 Eueung Mulyana | kakihijau.googlepages.com
  • 12. Interaction with Objects (4)  A method may have one or more parameters  You will be requested to give value(s) of the parameter(s) when you invoke such a method  Try the method setDirection() from a Wombat object or the method randomLeaves() from the WombatWorld  A method may also return one value (or reference to an object) if it is invoked  Try foundLeaf() or getLeavesEaten() from a Wombat object Introduction to Greenfoot 12 Eueung Mulyana | kakihijau.googlepages.com
  • 13. Removing Objects (1)  An object can be removed by selecting item „Remove“ from the object context menu  Clicking the „Reset“ button or creating a new World object from the class context menu may remove all objects; however it actually depends on the constructor implementation of the World class  (*) Introduction to Greenfoot 13 Eueung Mulyana | kakihijau.googlepages.com
  • 14. Removing Objects (2) Introduction to Greenfoot 14 Eueung Mulyana | kakihijau.googlepages.com
  • 15. Objects‘ Action  Each Actor object has a special method called act()  Pressing the button „Act“ on the control panel means asking Greenfoot to execute act() method for all objects in the world  An object acts by doing „whatever it wants to do“ e.g.: – Wombats move forward, if they find a leaf in their path, they will eat it – Leaves do nothing  The action depends actually on how act() method is defined; that is, we can program object behaviors!! Introduction to Greenfoot 15 Eueung Mulyana | kakihijau.googlepages.com
  • 16. Simulation „Run“  A scenario can be run by clicking the „Run“ button  This equivalent to clicking the „Act“ button over and over again very quickly  The slider next to the „Act“ and „Run“ buttons sets the „running/simulation“ speed  Make an experiment with scenario wombats – Click „Reset“ if you have already some objects – Select Populate() from the WombatWorld menu – Click „Run“ Introduction to Greenfoot 16 Eueung Mulyana | kakihijau.googlepages.com
  • 17. Simulation „Run“ Running wombats scenario Introduction to Greenfoot 17 Eueung Mulyana | kakihijau.googlepages.com
  • 18. Scenario plane (1)  Choose „Open ...“ from the „Scenario“ menu and select the plane scenario from the Greenfoot sample scenarios  Press the „Compile all“ button, if necessary  Instantiate a Plane object and place somewhere in the world  Run the scenario by pressing „Run“  Try to drag the ControlKnob object and observe the result Introduction to Greenfoot 18 Eueung Mulyana | kakihijau.googlepages.com
  • 19. Scenario plane (2) Introduction to Greenfoot 19 Eueung Mulyana | kakihijau.googlepages.com
  • 20. Scenario plane (3) Introduction to Greenfoot 20 Eueung Mulyana | kakihijau.googlepages.com
  • 21. Scenario turtleGraphics (1)  Choose „Open ...“ from the „Scenario“ menu and select the turtleGraphics scenario from the Greenfoot sample scenarios  Press the „Compile all“ button, if necessary  Instantiate several turtle objects (CircleTurtle, SquareTurtle, FlowerTurtle and SpiralTurtle) and place somewhere in the world  Run the scenario by pressing „Run“  Observe the result Introduction to Greenfoot 21 Eueung Mulyana | kakihijau.googlepages.com
  • 22. Scenario turtleGraphics (2) Introduction to Greenfoot 22 Eueung Mulyana | kakihijau.googlepages.com
  • 23. Scenario ants (1)  Choose „Open ...“ from the „Scenario“ menu and select the ants scenario from the Greenfoot sample scenarios  Press the „Compile all“ button, if necessary  By default (standard Greenfoot 1.3 distribution) you will have several objects, which are actually formed together as the World object is created; these objects are instances of the class AntHill and Food; other objects will be created „on-the-fly“  Run the scenario by pressing „Run“  Observe the result Introduction to Greenfoot 23 Eueung Mulyana | kakihijau.googlepages.com
  • 24. Scenario ants (2) Introduction to Greenfoot 24 Eueung Mulyana | kakihijau.googlepages.com
  • 25. Scenario lunarlander (1)  Choose „Open ...“ from the „Scenario“ menu and select the lunarlander scenario from the Greenfoot sample scenarios  Press the „Compile all“ button, if necessary  By default you will have a Lander object, which is actually formed together as the World object is created  Now you are ready to play the game; run the scenario by pressing „Run“  The rocket thrust can be controlled by pressing the „down“ key on the keyboard Introduction to Greenfoot 25 Eueung Mulyana | kakihijau.googlepages.com
  • 26. Scenario lunarlander (2) Introduction to Greenfoot 26 Eueung Mulyana | kakihijau.googlepages.com