![]() ![]() ![]() 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. So I set the sound on and press on play: my level 1 is loaded with the sound still playing. Stop playing this sound if it is currently playing. H hashCode() - Method in class greenfoot. GreenfootSound(String) - Constructor for class greenfoot.GreenfootSound. When i click on it the sound plays, if i press again the sour go off. Represents audio that can be played in Greenfoot. Just by using the method play, it will play just one time there is no need to stop or pause it. Making a GreenfootSound object will allow the methods in its class to control the sound object. It seems a bit redundant to have two arrays with exactly the same data. I try to explain more clearly I got two world: one is the menu of my game the other is the level in which my game evolves. I believe the Greenfoot method playSound causes the sound to be looped automatically and there is no control over that sound once it is started. 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) I am not sure what you were trying to do with line 1 (or why you wanted to create a method here).Public class PlayMusicButton extends Actor Sound of Music buie festok Paramount Theater Every day towa's person in The. ![]() Use of started () and stopped () method in World to avoid music that plays forever. Enjoy Teaches: Use of GreenfootSound API to create and optimize music and sound effects. Not intended for total beginners, though it could certainly be shared with them. If you got 'GreenfootSound( filename)' from the API, then you were looking at the constructor signature and you used it properly at the end of line 3. STOP Stor Meer NEW PRINCIPAL When the buses roll out each day, a new face. Im working on a game program for school and there are multiple levels. This includes a lot of tricks that even teachers may never have considered. The argument 'filename' is not used in the method anywhere - so there is no need to have the argument at all. Method names should give some indication as to what the method does the first word in the name should be a verb. Your expression to the right of the equal sign on line 3 looks good. Where would depend on when you wanted it to start. 'variableName' can be any name that follows the rules given at the bottom of this page. If not, there is a problem with your microphone - try googling to get help with that. You should see a green wave, and when you press play you should hear your noise played back to you. 'variableType' can be any primitive type (int, float, boolean, long, byte, char, etc.) or a class name (String, Color, Font, Actor, World, etc.). Press the record button and speak (or scrunch an empty food packet, or whatever), then press stop. VariableType variableName = expression_or_value Neither line 3 nor line 4 could possibly compile without an exception being thrown.Ī variable is assigned a value like as in the following (in pseudo-code): ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |