1.7 A Second Example.

Slides:



Advertisements
Similar presentations
Getting to know Greenfoot
Advertisements

Chapter 2 - The First Program: Little Crab
Program: Little Crab Mr Gano.
Chapter 6 - Interacting Objects: Newton’s Lab
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.
Objects and Classes First Programming Concepts. 14/10/2004Lecture 1a: Introduction 2 Fundamental Concepts object class method parameter data type.
Exercise Exercise3.1 8 Exercise3.1 9 Exercise
Exercise Exercise Exercise Exercise
Exercise Exercise Exercise Exercise
Exercise Exercise6.1 7 Exercise6.1 8 Exercise6.1 9.
Chapter 5 - Making Music: An On-Screen Piano
Chapter 2 (Horstmann’s Book) – Part 2 The Object-Oriented Design Process Hwajung Lee.
Object-Oriented Design & Patterns Cay S
Greenfoot. Getting Started Open the Greenfoot download site: Select Greenfoot
CSE 113 Introduction to Computer Programming Lecture slides for Week 2 Wednesday, September 7 th, 2011 Instructor: Scott Settembre.
Chapter 1 - Getting to know Greenfoot
Chapter 6 – Interacting Objects: Newton’s Lab. topics: objects interacting with each other, using helper classes, using classes from the Java library.
Greenfoot Game Programming Club.
Advanced Stuff Learning by example: Responding to the mouse.
Georgia Institute of Technology Creating Classes part 4 Barb Ericson Georgia Institute of Technology May 2006.
Introduction To Greenfoot
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th Edition Copyright © 2015 John Wiley & Sons, Inc. All rights.
Chapter 2 – The Little Crab Program:. Little Crab Scenario Inheritance: The Arrows Denote Hierarchy Crab is an Animal Animal is an Actor Therefore, It.
McGraw-Hill/Irwin© 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 17 Object-Oriented Design and Modeling Using the UML.
JAVA CLASSES, METHODS AND VARIABLES.  Defined Noun: A set or category of things having some property or attribute in common and differentiated from others.
Newton’s Lab Games and Simulations O-O Programming in Java.
Selection Statement Chapter 3. A Java Language Program Is a Class A Class has data declarations and methods A Method has statements or instructions to.
Chapter 4 - Finishing the Crab Game
Review for Test2. Scope 8 problems, 60 points. 1 Bonus problem (5 points) Coverage: – Test 1 coverage – Exception Handling, Switch Statement – Array of.
TK1924 Program Design & Problem Solving Session 2011/2012
Chapter 4 - Finishing the Crab Game
Parameters Section 8-8 Web Design.
OBJECT ORIENTED CONCEPT
Chapter 3 – Improving the Crab Game
The Object-Oriented Thought Process Chapter 1
COMP 2710 Software Construction Sequence Diagrams (cont.)
Chapter 8 Arrays, Strings and pointers
Chapter 3: Using Methods, Classes, and Objects
OBJECT ORIENTED PROGRAMMING II GEORGE KOUTSOGIANNAKIS
Behavioral Modeling.
Analysis Modeling Dynamic Modeling.
Creating Games with Greenfoot
Can perform actions and provide communication
Chapter 12 User Interface Design
Version 2.
The Little Crab Scenario
Talking about What is abuse?
Can perform actions and provide communication
Sequence Diagrams Lecture 6.
UML Diagrams: Sequence Diagrams Dynamic Analysis Model
Games and Simulations O-O Programming in Java The Walker School
Can perform actions and provide communication
 Click on a present to go to a question
Classes and Objects Still Chapter 1.
Adding Behaviors (methods)
Functions.
Methods, Data and Data Types
Greenfoot November 8, 2009.
Introduction to Computer Science
CLICK TO START.
CLICK TO START.
WJEC GCSE Computer Science
Chapter 13 Vector Functions
Call Now : Click : -
Call Now : Click : -
Call Now : Click : -
Presentation transcript:

1.7 A Second Example

1.8 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

1.9 Playing with Asteroids Start Playing by Creating Some Actor Objects (Objects of the Subclass of Actor). Create Objects for Rocket, Bullet, Asteroid, and Explosion

Exercise 1.10 Right Click on the Object

Exercise 1.10 Click on setGunReloadTime and Type 5

Exercise 1.11 Right Click on the Object and Select Inspect

Exercise 1.11 Right Click on the Object and Select Inspect

Exercise 1.12 Right Click on the Object and Select getSpeed ( )

Exercise 1.12

Exercise 1.13

Exercise 1.14 Right Click on the Object and Select setSize(int Size) and Set the Size to 256

1.10 Source Code Right Click on the Class and Select Open editor

Source Code for Rocket

Exercise 1.15 Change gunReloadTime from 20 to 5

Exercise 1.15

Exercise 1.15 Class Changed Class Compiled

1.11 Summary In this chapter, we have seen what Greenfoot scenarios can look like and how to interact with them. We have seen how to create objects and how to communicate with these objects by invoking their methods. Some methods are commands to objects, while other methods return information about the object. Parameters are used to provide additional information to methods, while return values pass information back to the caller.

Concept Summary