Home‎ > ‎ICT Programming‎ > ‎

Greenfoot Unit

Learn the basics by completing these tutorials with a partner. Complete this checklist with a partner as you complete each tutorial. Place finished checklist in the hand-in folder once all 6 tutorials are complete.

                            Tutorial 1 - Interacting with Greenfoot

                            Tutorial 2 - Movement and Key Control

                            Tutorial 3 - Detecting and Removing Actors and Making Methods

                            Tutorial 4 - Saving the World, Making and Playing Sound

                            Tutorial 5 - Adding a Randomly Moving Enemy

                            Tutorial 6 - How to Access One Object from Another

Need more help? Use these resources below to help you with your Greenfoot understanding.

Scratch 2 Greenfoot - Transition Guide (how to do Scratch methods in Greenfoot)

5 Day Platform Game Bootcamp

Day 1 - Creating your animated character


Day 2 - Falling and jumping


Day 3 - Scrolling Background


Day 4 - Objects and scoring


Day 5 - Adding health


Reverse engineering resource. If you're stuck, look at the original code and then customize it to make it your own.

See original Platform Game Code

Now choose 1 of the following 4 projects to complete, ranked in order of difficulty.

A) Basic Mover

1. Create a Greenfoot world
2. Create a Greenfoot Actor and place in the center of the world
3. Write a method that allows the user to use the arrow keys to move the Actor around the world.

Code Samples for Basic Mover

B) Target Game

1. Create a Greenfoot world with a 400x400 grid with size of 1 px.
2. Create subclass Actors from "Sprite":

  • Shooter
  • Ball
  • Target

3. Ball must start at the shooter and move when "Space" key is pressed.
4. If Ball touches the Target - the Target must disappear.
5. When Ball reaches the edge of the Screen, the Ball must move back to the Shooter.

Code Samples for Target Game

C) Pong

1. Create a Greenfoot world with a 500x400 grid with size of 1 px.
2. Create subclass Actors from "Sprite":

  • Paddle
  • Ball
  • Paddle2

3. Ball must move by itself and bounce off the walls and the Paddles.
4. The Paddle must move up and down with the User controlling the mouse.
5. Paddle 2 must move by itself while tracking the Ball.

Code Samples for Pong

D) Virtual Xylophone


1. Download and unzip "XylophoneProjectBase" file and Save to your file area.
2. Write Code for "Bar" class that defines 4 variables that control pitch, image, image pressed, and key event.
3. Write Code for "Bar" that defines a Method to play the sound on mouse click and Key event. 
4. Write Code for "Bar" that defines a Method to change the image when Bar is clicked or Key is pressed.
5. Write Code for each xylophone bar that sets the variables and calls the Method to play sound and change image.