Creating Games with Greenfoot

Slides:



Advertisements
Similar presentations
Introduction to Macromedia Director 8.5 – Lingo
Advertisements

Create a Simple Game in Scratch
Create a Simple Game in Scratch
Getting to know Greenfoot
Games and Simulations O-O Programming in Java The Walker School
Animation Mrs. C. Furman. Animation  We can animate our crab by switching the image between two pictures.  crab.png and crab2.png.
Chapter 2 - The First Program: Little Crab
Program: Little Crab Mr Gano.
Code Club Session 3 Shark Eats Fish. Picture of finished product here.
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.
Scratch Understanding some programming techniques using Scratch Resetting, Parallelism and Events.
INTRODUCTION TO THE SCRATCH PROGRAMMING ENVIRONMENT.
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.
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
Bug Session Four. Session description Objectives Session activities summary Resources Prior knowledge of sequencing instructions using Bug Bug website.
Chapter 1 - Getting to know Greenfoot
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 Computer Programming - Project 2 Intro to Digital Technology.
Scratch for Interactivity Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
Chapter 2 – The Little Crab Program:. Little Crab Scenario Inheritance: The Arrows Denote Hierarchy Crab is an Animal Animal is an Actor Therefore, It.
Adding and Eating Worms Mrs. C. Furman August 23, 2010.
Introduction to Programming with Scratch Exploring Computer Science – Lesson 4-1.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Chapter 4 - Finishing the Crab Game
Greenfoot.
Chapter 4 - Finishing the Crab Game
Create a Halloween Computer Game in Scratch
Scratch for Interactivity
Manipulating Pictures, Arrays, and Loops part 2
Customizing the Toolbar
Scratch Unit Overview We are going to look at computer programming and how to create your very own computer game The piece of software we will be using.
Chapter 3 – Improving the Crab Game
Introduction To Greenfoot
Unit 2 Getting Started With
Scratch for Interactivity
MS PowerPoint 2010 Week 2.
Manipulating Pictures, Arrays, and Loops part 2
Version 2.
Database Queries.
The Little Crab Scenario
Estimating With Decimals
Learn… Create… Program
Go to =>
Learn… Create… Program
Problem Solving with Data Structures using Java: A Multimedia Approach
Scratch for Storytelling
Northwest School Division #203
Problem Solving Designing Algorithms.
Learning Objectives Explain how selection is used to change a program output Decompose a problem with inputs to help design a program Describe the use.
Using screens and adding two numbers - addda.cbl
Methods, Data and Data Types
Introduction to Snap Programming
Greenfoot November 8, 2009.
Manipulating Pictures, Arrays, and Loops
Learn… Create… Program
Learn… Create… Program
Creating a Simple Game in Scratch
Bishopston Comprehensive School
Ecology Lab Instructions
Day 3: Working with Tables
Presentation transcript:

Creating Games with Greenfoot Overall time on activity: 30 minutes Wombats Creating Games with Greenfoot

What is Greenfoot? A free environment that makes it easy to create 2D animations, simulations, and games

Getting Started To start Greenfoot click on Greenfoot. 2 mins Getting Started To start Greenfoot click on Greenfoot. Click on “Scenario” in the menu Choose Open Pick the wombats scenario It starts by showing an empty WombatWorld Which is a 2D grid of cells

Adding Objects to the World 3 mins Adding Objects to the World Right click on Wombat in the class display to see a pop-up menu Create a Wombat by selecting new Wombat() A picture of a wombat will appear attached to the cursor Click in the world to place the wombat Shift-click to place more than one object Class Display

Add Leaves Add several leaves to the world 1 mins Add Leaves Add several leaves to the world Right click on Leaf in the class display Quickest: Hold down the shift key Click in the grid to place each leaf

Greenfoot Objects There are two basic types of things in Greenfoot Worlds and actors. Worlds hold actors a stage for actors Actors can act They may move They may eat food They may stay where they are

Run the Simulation Click on act to execute one simulation time step 4 mins Run the Simulation Click on act to execute one simulation time step Act one time Click on run to have it continuously execute time steps Keep acting till you Click on pause to stop Click on reset to start over With a new WombatWorld Execution Controls

What Happened? Questions How did the wombats move? Did they eat any leaves? Did the leaves move? What happened when a wombat reached the edge of the world? If you don’t know the answer to any of these questions place more wombats and/or leaves in the world and run again Or click on act to see things in slow motion

The Wombat Scenario To get information on any scenario Click on the Project Information button In top right corner above the class display Read the displayed documentation Click close when done

Actor Methods You can see and execute all methods that an actor knows how to do By right clicking on an actor in the grid Select a method to execute it You can call some other methods as well

Method Return type The words before the methods define the return type of a method. If the behavior is about changing the state of the object, the return type will be “void” which means it is telling the object to do something. The other is a non-void type which is asking the object a question. And specifies what the return type will be. A method with a void return type does not return a value. A non-void method returns a value.

Return Types non-void return a value.

Exercises 8 mins Call out the canMove( ) method on your wombat. Does it always return true? Or can you find situations in which it returns false? Using a newly created wombat, the getLeavesEaten ( ) method will always return zero. Can you create a situation in which the result of this method is not zero? Call out the setDirection (int direction) method. Provide a parameter value and see what happens. Which number corresponds to which direction? Write them down. What happens when you type in a number greater than 3? What happens if you provide input that is not a whole number, such as a decimal number (2.5) or a word (three)?

World Methods Right click near the title of the world To show the world menu Select populate() This will add wombats and leaves to the world Then click on run What happens? Do all the leaves get eaten?

Changing Actors Changing Actors Right click on the actor’s class Choose “Set Image” Choose the image from the library Compile the program

What I have learnt this lesson: Scratch and Greenfoot share some themes: Sprite = Actor, Stage = World Greenfoot scenarios consist of classes Many Objects can be created from a class The return type of a method specifies what a method will return Methods with non-void return type represent questions; Methods with void return types represent commands. Collaborate, be creative and pursue the a solution.