
* Wombat. A Wombat moves forward until it can't do so anymore, at The Wombats are animated like in the Greenfoot scenario (we maintain the original comments): " Just hit the screen and another object of the same class with exactly the same properties and behavior is born".

Moreover the smartphone touch screen provides a wonderful teaching vehicle to demonstrate the power of object oriented programming:

Touching the screen gives a new feeling for conventional mouse and console oriented programmers. Touch events creates new rocks by a fingertip. Location location = toLocationInGrid(touch.getX(), touch.getY()) Public class WombatWorld extends GameGrid implements GGTouchListener We proceed top-down and first show the application class:
#GREENFOOT WORLD API INSTALL#
(To get it, download and install the Greenfoot distribution from here or just get the scenario code from here.) In both versions there are the same 4 classes: WombatWorld (the application class) and three classes derived from Actor: Wombat, Leaf and Rock.

#GREENFOOT WORLD API ANDROID#
To understand how much the Android code coincide with the Greenfoot code, you should have the Greenfoot version at hand. As you will see the code is almost the same and, due to the large panoply of JDroidLib methods, even simplified. We take the Greenfoot Wombat scenario that is used in many introductory teaching sessions and port it to Android. folder 'sprites', and use a qualified filename in the Actor constructor like "sprites/image.png"). (We suggest to use the online editor/compiler at, that is part of a rich e-learning site of PHBern, the Institute for Teacher Education at the University of Berne ( To load your own sprite images when using the Online-Editor, copy the image files in any subdirectory on the SD card, e.g. It is a challenge to simplify the installation and use of the Android development tools as much to be used in a classroom. Of course the Android development environment is much more complicated than Greenfoot's BlueJ based IDE. JDroidLib hides most of these differences by exposing almost the same classes and methods as the desktop based framework JGameGrid. So what makes the difference? Because apps have a completely different (and in many respects much simpler) user interface compared to desktop applications, all of the GUI classes that are part of the Java SE API (especially the Swing and AWT classes) are replaced. Because Java on Android is compiled using the standard javac compiler, Android is 100 percent Java. With JDroidLib developing game apps for smartphones is simplified by an order of magnitude compared to basic Android API programming. Therefore the simple concept of Greenfoot has been ported to Android smartphones by the JDroidLib framework. No doubt, constructing computer games is motivating, but because in these modern times everyone is much concerned by using smartphones and tablets, developing games as smartphone or tablet app gives an extra motivation kick. Greenfoot is much appreciated by teachers and students for its simple concept and user-friendly implementation in educational institutions all over the world. Greenfoot is an environment for teaching Java programming with the focus on game development. Bringing the conceptual strength of Greenfoot to Android

The source code of all examples is included in the JDroidLib distribution.
