![]() One of my favourite IDEs out there is BlueJ. If the object is to be deleted when one of these is created, the same basic code structure would suffice. A free Java Development Environment designed for beginners, used by millions worldwide. The best you can do is use the UserInfo class to save any information (which would be 11 ints and 5 Strings of 50 characters each, per user). Just be aware that you cannot write to a file on the Greenfoot site. I did not see any code, or attempt at code to add a man or a flower when the "enter" key was pressed. Guck dir dazu mal java.io.FileWriter und Reader an. In short, the code in 'bee' and in 'aligator' are, in essence, OK. Fortunately, because you are removing the 'bee' or the 'aligator' object when the appropriate key is pressed, it does act only once (barring the actions of the 'start' object). protected void, addedToWorld(World world). Press Enter and note how IntelliJ automatically adds the neccecary import statement 'import greenfoot.World' at the top of the file. The act method is called by the greenfoot framework to give actors a chance to perform some action. After a second or so a completion for 'greenfoot.World' should show up. Place the cursor behind the class name and type 'extends World'. Anyway, 'isKeyDown(String key)' is intended for repetitive action, whereas 'getKey()' is intended to act once for each keypress. Give your class a valid Java name and press Enter. However, you probably did not intent for the code dealing with keystrokes in your 'start' object to be there. Greenfoot is a combination of a Java IDE that provides a class browser, compilation, interactive execution, single-step execution, a code editor, etc. When using the former, if the key is down (referring to your scenario, with "up") the act of creating a new object repeats until you release the key (at least as far as the 'start' object is concerned). One thing I have noticed, is that you are using isKeyDown(String key), where you should probably be using getKey().
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |