Trying to make game where you can buy items with points and make it so that every time you buy an item, the cost of it goes up and the amount of points back you get go up. I have it so that the cost goes up but can't figure out the points back part.
and
I appreciate any help
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class Arrow extends Actor
{
public void act()
{
GetArrow();
}
public int timer2 = 100;
public int GN = 0;
public int add1 = 50;
public void GetArrow()
{
//if(timer2 > 0) {
timer2 --;
//}
if(timer2 == 0){
BackGround theWorld = (BackGround) getWorld();
Counter counter = theWorld.getCounter();
decideAdd1();
GN++;
}
}
public void decideAdd1(){
add1 = add1 + ((3^(GN+1))*GN) + (1+(3^GN)*(GN));
}
}import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class ArrowBotton extends Bottons
{
public int cost1 = 25;
public int GN = 0;
public ArrowBotton()
{
setImage(new GreenfootImage("Buy Arrow: " + cost1, 20, Color.WHITE, Color.BLUE));
}
public void act()
{
if(Greenfoot.mouseClicked(this)==true)
checkBuy();
setImage(new GreenfootImage("Buy Arrow: " + cost1, 20, Color.WHITE, Color.BLUE));
}
public void checkBuy()
{
BackGround theWorld = (BackGround) getWorld();
Counter counter = theWorld.getCounter();
if(counter.getValue() >=cost1 ){
counter.subtract(cost1);
GN ++;
decideCost();
theWorld.addObject(new Arrow(),0,0);
theWorld.getObjects(Arrow.class).get(0).decideAdd1();
}
}
public void decideCost(){
cost1 = cost1 + ((3^(GN+1))*GN) + (1+(3^GN)*(GN));
}
}

