I want to make A shop in my game but when you buy somthing the money score should change but it doesen't. Here is the code. you schuld now that "Geld" means money.
public class Shop extends Objects
{
int Geld = 0;
/**
* Act - do whatever the Shop wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if(Greenfoot.mouseClicked(this)){
getWorld().addObject(new He162price(),500 ,500);
getWorld().addObject(new Ki67price(),500 ,565);
getWorld().addObject(new Meteorprice(),500 ,637);
getWorld().addObject(new Mitchellprice(),500 ,704);
getWorld().addObject(new Spitfireprice(),500 ,760);
getWorld().addObject(new Yakprice(),500 ,800);
getWorld().addObject(new bf109price(),500 ,850);
}
if(Greenfoot.mouseClicked(getWorld())){
getWorld().removeObjects(getWorld().getObjects(He162price.class));
getWorld().removeObjects(getWorld().getObjects(Ki67price.class));
getWorld().removeObjects(getWorld().getObjects(Meteorprice.class));
getWorld().removeObjects(getWorld().getObjects(Mitchellprice.class));
getWorld().removeObjects(getWorld().getObjects(Spitfireprice.class));
getWorld().removeObjects(getWorld().getObjects(Yakprice.class));
getWorld().removeObjects(getWorld().getObjects(bf109price.class));
}
if (Greenfoot.mouseClicked(He162price.class)){
Geld = Geld - 800;
getWorld().addObject(new He162(),250 ,485);
}
if (Greenfoot.mouseClicked(Ki67price.class)){
getWorld().addObject(new KI67(),250 ,485);
Geld = Geld - 700;
}
if (Greenfoot.mouseClicked(Meteorprice.class)){
Geld = Geld - 1000;
getWorld().addObject(new Meteor(),250 ,485);
}
if (Greenfoot.mouseClicked(Mitchellprice.class)){
Geld = Geld - 800;
getWorld().addObject(new Mitchell(),250 ,485);
}
if (Greenfoot.mouseClicked(Spitfireprice.class)){
Geld = Geld - 400;
getWorld().addObject(new Spitfire(),250 ,485);
}
if (Greenfoot.mouseClicked(Yakprice.class)){
Geld = Geld - 400;
getWorld().addObject(new Yak9(),250 ,485);
}
if (Greenfoot.mouseClicked(bf109price.class)){
Geld = Geld - 500;
getWorld().addObject(new BF109(),250 ,485);
}
getWorld().showText("Geld: " + Geld , 280, 400);
getWorld().showText("$" , 335, 400);
}
}

