Both 'World' and 'Actor' are abstract classes - that is: you cannot create any objects of them. That is: you have the 'World' and 'Actor' classes in the class display, and not much else. The scenario will be opened, and you will see a screen similar to the one on the left. Greenfoot will create a folder with that name that contains all files associated with your scenario. Doing this is easy: choose 'New' from the 'Scenario' menu, and select a location and name for your scenario. Have fun! 2 Creating a new scenario The first thing to do when you want to create your own program is to create your own scenario. You can find them in the 'scenarios' folder. All these scenarios are included in the standard Greenfoot distribution. Every now and then, when it is useful to refer to examples, we will use the 'wombats', 'ants', 'balloons' and 'lunarlander' scenarios as examples. The secitons in this manual were written with the goal that they can be read independently - there is no strong need to read everything in order. You may, for instance, be interested in generating actor images in a certain way, or in dealing with collisions. Feel free to jump right into the middle of this manual and start reading there. In that case, you already have a scenario, a world, and one or more actor classes. In fact, probably the most common way for people to start programming in Greenfoot is by modifying an existing scenario. This may not be the order in which you approach your own personal Greenfoot programming experience. It starts from the start: We first discuss how to create a new scenario, then how to create worlds and actors, and so on. For tutorials, videos and a quickstart guide for Greenfoot, see the 'Getting Started' section on This manual is an introduction to programming in Greenfoot. It supports development of graphical applications in the JavaTM Programming Language. 1 Introduction Creating a new scenario Using the API Creating a world Creating new actors Making things move Random behavious Dealing with images Detecting other objects (collisions) Keyboard input Mouse input Playing audio Controlling the scenario Using support classes Exporting a scenario Introduction Greenfoot is a software tool designed to let beginners get experience with object-oriented programming. You could probably eliminate either the 'soundFiles' or the 'songNames' array and use the same data for both creating the sound objects and displaying their names.The Greenfoot Programmers' Manual Version 1.1 for Greenfoot 2.0 Michael Kölling, Martin Pain University of Kent Copyright © M Kölling, 2006, 2009, 2010 The Greenfoot Programmers' Manual is licensed under a Creative Commons Attribution-Non-Commercial 2.0 UK: England & Wales License. It seems a bit redundant to have two arrays with exactly the same data. But, the above should get your fields (which I renamed to more properly fit what they represent) and their references set up properly. I am quite sure that things will need to be tended to there as well. This also does not presume that the rest of the class is fine and correct. I presumes that your sound files are ".mp3" files - if not, you need to make the necessary correction. If(!selected & Greenfoot.mouseClicked(this)) This shows the adjustments to the beginning of your class. Public PlayMusicButton(String soundFiles, String songNames, Color colors) Public class PlayMusicButton extends Actor
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |