setTransparency(int) - Method in class greenfoot. * key and a sound file, which is played when the key is pressed. Setzt den String value am entsprechenden Index (0 bis NUMSTRINGS -1, inklusiv). * This method makes the below keys when compile is hit or the program opens.ĪddObject (new Key ("g", "3a.wav"), i*63 + 54, 140) * A piano that can be played with the computer keyboard. Import greenfoot.* // (World, Actor, GreenfootImage, and Greenfoot) Here is the code example from the piano class: I am confused in general how the program knows that the keys are set from left to right in the first place. The remaining keys should be next to each other, with no space between them." Teaches: Use of GreenfootSound API to create and optimize music and sound effects. Rewrite it (in this document only-not in your working Greenfoot program) to create the keys from right to left, instead of left to right, and force the rightmost key to be flush against the right side of the screen. With this information in mind, copy the new loop code you entered to correctly place the keys in the space below. (1) You cannot use aySound method You can only control the volume of a GreenfootSound object. Recall that the piano is 800 pixels wide. However, here are some things to keep in mind. static void: setSpeed(int speed) Legt die Ausführungsgeschwindigkeit fest. "According to the text, Greenfoot refers to objects by the midpoint of their lengths and widths. playSound(String soundFile) Spielt eine Sounddatei ab. I am working on exercise 5.18 (not the same as the book example) and it says: Check the Sounds Folder Greenfoot Tutorial Sound files must be placed the sounds folder of your Greenfoot project to be used in the game. Public double getNumericGrade() - Returns the numeric grade in the range 0.0 <= grade <= 4.0.Ĭode to test the program goes in Program.I am working on my assignment for school and this question has thrown me for a loop, no pun intended, this chapter is about loops and arrays. Public String getLetterGrade() - Returns the grade as a String. Public Grade(String grade) - Constructor that sets the grade as a String. This object will have a constructor that takes one argument and the following two methods: NOTE: You may not hard-code the return value for +/- grades, but must add or subtract 0.3. Note that an "A+" is still 4.0 points and an "F+" or "F-" is still 0 grade points. The + sign adds 0.3 to the grade points and the - sign subtracts 0.3. The letter values are worth 4.0 grade points for an A, 3.0 for a B, 2.0 for a C, 1.0 for a D, and 0 for an F. A, B, C, D, F) followed by an optional sign (e.g. This grade has the form of a letter (e.g. You are to write a program that will take a grade as a String. Yo I am also a student but I looked on the forums for help So basically, you need to get a recording of your sound and then put it in the sounds folder of your greenfoot project. Hello, I need help with this simple Java program. * Use the method aySound( filename) to play the sound When the mouse is clicked on this object, play the sound. Startet das Abspielen des Sounds in einer sich wiederholenden Schleife. * the 'Act' or 'Run' button gets pressed in the environment. * Act - do whatever the Emoticon wants to do. Use the method setImage( filename) to set the image. set the instance variable sound to the value passed by the corresponding parameter set the instance variable image to the value passed by the corresponding parameter * Create two instance variables of type String
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |