Stage::addSound()
Adds a new sound. The file needs to be a mp3, wav or ogg file.
Examples
import org.openpatch.scratch.*;
public class StageAddSound {
public StageAddSound() {
Stage myStage = new Stage(600, 240);
myStage.addSound("bump", "assets/bump.wav");
myStage.exit();
}
public static void main(String[] args) {
new StageAddSound();
}
}
Syntax
Java
.addSound(name, filePath)
Scratch
Parameters
Name | Data Type | Description |
---|---|---|
name | String | The name of the sound |
filePath | String | The file path of the sound file |
Return
void