CubeGamer6 wrote...
Lavenger wrote...
It says: "cannot find symbol- method adjustYen(int)"import greenfoot.*;
public class MyWorld extends World
{
// fields usually (by convention) go first
private int Yen;
private int YenTimer;
private Actor YenDisplay = new Yen();
// class constructors usually (by convention) go next
public MyWorld()
{
super(1400, 675, 1);
adjustYen(0); // to initialize image
addObject(YenDisplay, 100, 30); // wherever
}
// methods (by convention) go last
public int getAccumulatedYen()
{
return Yen;
}
public void adjustYen(int adjustment)
{
Yen += adjustment;
YenDisplay.setImage(new GreenfootImage("Yen: "+Yen, 30, Color.BLACK, Color.WHITE));
}
public void act()
{
accumulateYen();
}
private void accumulateYen()
{
YenTimer = (YenTimer+1)%60;
if (YenTimer == 0) adjustYen(1);
}
private void prepare()
{
addObject(new Umaru(), 700, 338);
addObject(new Taihei(), 1356,108);
}
}
import greenfoot.*;
public class Umaru extends Actor
{
public void act()
{
GainYen();
}
private boolean once = false;
public boolean repeatBuff = false; // you can set this to true and it will start repeating
private int YenPerMin = 90;
private int YenPerAct = 1;
public void GainYen()
{
float YenAdjustment = 0; // every cycle this value will pe deposited onto the world's yen value
if(Greenfoot.isKeyDown("space") && (!once || repeatBuff))
{
YenAdjustment += YenPerAct;
once = true;
}
else if(!Greenfoot.isKeyDown("space") && once)
{
once = false;
}
Greenfoot.setSpeed(50);
YenAdjustment += YenPerMin / 60f / 50;
MyWorld mw = (MyWorld)getWorld();
mw.adjustYen(YenAdjustment);
// When buying something, only subtract the price from AGold!
}
}import greenfoot.*;
public class MyWorld extends World
{
// fields usually (by convention) go first
public float AYen; //precise
public int DYen; //rounded
public Yen YenDisplay = new Yen();
// class constructors usually (by convention) go next
public MyWorld()
{
super(1400, 675, 1);
adjustYen(0); // to initialize image
prepare();
addObject(YenDisplay, 100, 30); // wherever
}
// methods (by convention) go last
public int getAccumulatedYen()
{
return DYen;
}
public void adjustYen(float adjustment)
{
AYen += adjustment;
DYen = (int) AYen;
YenDisplay.setImage(new GreenfootImage("Yen: "+DYen, 30, Color.BLACK, Color.WHITE));
}
private void prepare()
{
addObject(new Umaru(), 700, 338);
addObject(new Taihei(), 1356,108);
}
}import greenfoot.*;
public class Umaru extends Actor
{
public void act()
{
GainYen();
}
private boolean once = false;
public boolean repeatBuff = false; // you can set this to true and it will start repeating
private int YenPerMin = 90;
private int YenPerAct = 1;
public void GainYen()
{
float YenAdjustment = 0; // every cycle this value will pe deposited onto the world's yen value
if(Greenfoot.isKeyDown("space") && (!once || repeatBuff))
{
YenAdjustment += YenPerAct;
once = true;
}
else if(!Greenfoot.isKeyDown("space") && once)
{
once = false;
}
Greenfoot.setSpeed(50);
YenAdjustment += YenPerMin / 60f / 50;
MyWorld mw = (MyWorld)getWorld();
mw.adjustYen(YenAdjustment);
// When buying something, only subtract the price from AGold!
}
}import greenfoot.*;
public class MyWorld extends World
{
// fields usually (by convention) go first
public float AYen; //precise
public int DYen; //rounded
public Yen YenDisplay = new Yen();
// class constructors usually (by convention) go next
public MyWorld()
{
super(1400, 675, 1);
adjustYen(0); // to initialize image
prepare();
addObject(YenDisplay, 100, 30); // wherever
}
// methods (by convention) go last
public int getAccumulatedYen()
{
return DYen;
}
public void adjustYen(float adjustment)
{
AYen += adjustment;
DYen = (int) AYen;
YenDisplay.setImage(new GreenfootImage("Yen: "+DYen, 30, Color.BLACK, Color.WHITE));
}
private void prepare()
{
addObject(new Umaru(), 700, 338);
addObject(new Taihei(), 1356,108);
}
}