I have a button, when you click adds 1 to score displayed at top of screen
I have another button that i want to add 10 to the increase of the main button (which increases score)
here is my code how would i make this happen
Main click.
My increase main clicker button code
Thanks
import greenfoot.*;
/**
* Write a description of class BlueClick here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class BlueClick extends Actor
{
private int var = 0;
private int add = 1;
/**
* Act - do whatever the BlueClick wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
getWorld().showText("Score: " +var, 100, 40);
if (Greenfoot.mouseClicked(this))
{
var = var + add;
}
}
}
import greenfoot.*;
/**
* Write a description of class plus_ten_upgrade here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class plus_ten_upgrade extends Actor
{
/**
* Act - do whatever the plus_ten_upgrade wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
getWorld().showText("+10", 50, 82);
if (Greenfoot.mouseClicked(this))
{
}
}
}
