

The greenfoot system also provides a full IDE, including integrated editing, compilation, creation of new classes, object inspection and a source level debugger. Scenarios are completely decoupled from the visualisation and interaction framework, so that greenfoot can be used for a wide variety of graphical applications. In addition to this, greenfoot allows direct interactive method calls on simulation objects, similar to the interaction facilities in the BlueJ environment. One aspect of greenfoot is that it allows visualisation of appearance and location of simulation objects in a two- dimensional grid, similar to micro world systems, such as Karel J. It provides a framework and environment to create interactive, simulation-like applications in a two-dimensional plane. The greenfoot system is an interactive object world. We describe the motivation and environment mechanism for supporting this below. The goal of supporting an interaction mechanism for running applications – for the purpose of developing game-like applications – has recently been added and was not included in earlier discussions of design goals. Some of these design goals have been discussed in more detail in.
#Greenfoot world code#
If you want to share code between your levels (e.g. They will both appear directly beneath World in the class diagram. So you might have: class Level1 extends World In Greenfoot, levels are usually implemented by having different worlds. SetLocation (getX() + animationSpeed, getY()) SetLocation (getX() - animationSpeed, getY()) Integers that help control the speed of movement and animationįor (int imageCounter = 0 imageCounter runningRight.length - 1)Ĭ = (Clover)getOneIntersectingObject(Clover.class) Ĭ1 = (SpecialTreat1)getOneIntersectingObject(SpecialTreat1.class) Ĭ2 = (SpecialTreat2)getOneIntersectingObject(SpecialTreat2.class)

Declare Greenfoot images for standing still facing left and right Declare arrays of Greenfoot images for animation import greenfoot.* // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) How am I supposed to do that? In other words, I can't seem to transfer the same things from GameWorld to Level1, which includes the clovers, candies, and score board, when a certain condition is met (i.e., a specific number of points is reached)? FYI: I've used a separate actor for the score board (hope this helps.).

However, the thing is that I want to create multiple levels, and that I kind of want what I have for the first world (named GameWorld) to appear in level 1, which is in a different world. What this game basically does is that the actor, Doggie, will try his best to catch the clovers and special treats that seems to be falling from the trees by running back and forth across the screen (through the user's left and right arrow keyboard input, of course). For a Greenfoot final class project, I decided to make a game called "Doggie the Super Catcher".
