
#Greenfoot sound how to#
* Act - do whatever the Down wants to do. This tutorial will explain how to initialise the world with actors, as well as how to play and record sounds. * the 'Act' or 'Run' button gets pressed in the environment.Įlse if(Greenfoot.mouseClicked(this) & !off) Ive been trying to figure out what exactly is the problem here class Player1 is supposed to play the wilhelm scream sound effect when hit by Player2Bullet. (3) the sound file is named wind.wav (not breathe.wav as earlier posted). (2) the sound file does play when double clicked from with the directory. (1) I have created a new sound file in the greenfoot scenarios folder and placed my sound file there.


#Greenfoot sound code#
just copy all your sound files into the folder sounds in your project folder, then you can use them in your code with aySound ('sound.mp3') or ayLoop () if song is an GreenfootSound. The code you gave above does not reference that sound file. You will have to copy/paste them into the sounds directory of your project. * Act - do whatever the Play wants to do. Greenfoot does not have an import function for sound files. Here it is aySound('popLow.wav') Any advice would be appreciated. I've followed my teacher's instructions, but no sound is coming out, but it does come out for his code. void: setVolume(int level) Set the current volume of. I'm doing a project for school, and I need some sound in it. void: playLoop() Play this sound repeatedly in a loop.

void: pause() Pauses the current sound if it is currently playing. Public GreenfootSound sound = new GreenfootSound("AdventureOfaLifetime.mp3") Get the current volume of the sound, between 0 (off) and 100 (loudest.) boolean: isPlaying() True if the sound is currently playing. I am trying to increase the volume bu one when the up button is pushed and decrease the volume by 1 when the down button is pushed I am fairly new to programming so any help would be great. I have some code that I think should be working but it isnt. I am trying to create a simple mp3 player in green foot and use buttons to control the volume. How to stop aySound ('xxxx') i make a sound but i don't know how to stop aySound () when i click button next, can help me Andriyanto i want, when i click button next, so aySound () stop. With your actors not moving, you need to have a public method in whatever class you have the sound playing (if it's not in your World, I strongly recommend putting it there) that will return a boolean value, true if the sound is playing, or false otherwise (hmm, that isPlaying() method might come in handy).
