Greenfoot Programming Environment

  • greenfoot programming help
  • Introduction to Greenfoot Programming Environment:

    Greenfoot is a software tool designed to let beginners get experience with object-oriented programming. Greenfoot model consists of a World className (represented by a rectangular screen area) and any number of actor objects that are present in the world and can be programmed to act independently. In Greenfoot environment the world and actors are represented by Java objects and defined by Java classes. It offers methods to easily program these actors, including method for movement, collision detection, changes of appearance and rotation. One of the goals of Greenfoot is a design that explicitly visualizes important concepts of object-oriented programming.

    New feature of Greenfoot include:

    • Scope highlighting
    • New navigation view
    • Better Find and Replace
    • Code completion

Greenfoot Programming Code

/**Turn in a random direction.
public void turnRandom()
//get a random number between 0 and 3...
int turns= Greenfoot.getRandomNumber(4);
// trun left that many times.
for(int i=0; i<turns; i++){
Then we modify 'act()' to make use of turnRandom. The act () method currently reads:
public void act()
else if(canMove()){
public void act()
    setLocation (getX() + 4, getY());
    // Moves the object 4 cells to the right
    setRotation (getRotation() + 2);
    // Rotates the object 2 degrees clockwise
An example of a simple act method in Greenfoot
Actor a = getOneIntersectingObject(Asteroid.className);
if (a != null) {
    // we have hit an asteroid!

An example of simple collision detection

greenfoot code

Greenfoot Programming Environment

greenfoot programming environment
Improve Your Grades with Custom Writing Help
Homework Help
Writing Help
Editing Services
Plagiarism check
Proofreading services
Research Project help
Custom writing services
E learning blogs

Disclaimer : The study tools and academic assistance/guidance through online tutoring sessions provided by AssignmentHelp.Net is to help and enable students to compete academically. The website does not provide ghostwriting services and has ZERO TOLERANCE towards misuse of the services. In case any user is found misusing our services, the user's account will be immediately terminated.