3/8/2023 0 Comments Install greenfoot![]() 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: (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. 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 ![]() It's still of course nowhere near the IntelliJ editor, nor will it ever be, but it certainly makes developing in it more tolerable if you're used to something more advanced.The source code of all examples is included in the JDroidLib distribution. If you haven't noticed already, Greenfoot 2 is now out with a much improved editor that supports basic code completion and intelli-sense. The developers could potentially focus their time in providing official support for coding in other IDE's, but the amount of work required means it's pretty much been decided it's not worth doing. I've often wanted to use a professional IDE for doing Greenfoot work myself, but the simple answer is that Greenfoot is primarily focused for beginners, for a fun and interactive way of teaching Java to people who have never programmed previously. ![]() It's more by accident than design that it works at all this way. As you've found already you can add libraries and mess around to get some bits working, but it's not officially supported (so might change from release to release or break) and most likely never will be.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |