Trying to lower volume in my scenarios World.
But it does not work. HELP.
My settings OBJECT/CLASS (ACTOR).
The world where these setting should work:
I think I am doing something wrong with this part :
specifically
Oh, and also I think I add object wrong:
x and y are -200 so that i wouldn't see the green foot on my screen.
If my "addobject" and "if statement" are good, then
my guess would be that my song/music volume is not decreasing because act is always acting it. Anyway I'm not good at programming, just started, it looks fun but I'm inexperienced.
import greenfoot.*;
public class Settings extends Actor
{
static int leftOffset = -50;
static int leftSpawn = -50;
static int rightOffset = 950;
static int rightSpawn = 950;
static int volume = 10;
public void act()
{
volume();
}
public void volume()
{
if (volume == 10)
{
if (Greenfoot.isKeyDown("-"))
{
Meniu.meniu.setVolume(90);
}
}
else if (volume == 9)
{
if (Greenfoot.isKeyDown("-"))
{
Meniu.meniu.setVolume(80);
}
}
else if (volume == 8)
{
if (Greenfoot.isKeyDown("-"))
{
Meniu.meniu.setVolume(70);
}
}
else if (volume == 7)
{
if (Greenfoot.isKeyDown("-"))
{
Meniu.meniu.setVolume(60);
}
}
volume--;
}
}
import greenfoot.*;
public class Meniu extends World
{
public Meniu()
{
super(900, 600, 1, false);
prepare();
}
public void prepare()
{
Settings settings = new Settings();
addObject(settings, -200, -200);
}
static GreenfootSound meniu = new GreenfootSound("Meniu.mp3");
public void act()
{
meniu.play();
if (Greenfoot.isKeyDown("enter"))
{
meniu.stop();
Greenfoot.setWorld(new GameWorld1());
}
}
}
if (volume == 10)
{
if (Greenfoot.isKeyDown("-"))
{
Meniu.meniu.setVolume(90);
}
}Meniu.meniu.setVolume(90);
Settings settings = new Settings();
addObject(settings, -200, -200);

