Hello guys,
I want to print the text when my quarter touches the gumball machine before machine takes the quarter.
I used two types of code
1.this REPLACES my machine with the text
Actor coin;
coin=getOneObjectAtOffset(0,0,Coin.class);
if(coin !=null)
{
World world=getWorld();
GreenfootImage m=new GreenfootImage(100,100);
m.drawString("have coin",0,50);
setImage(m);
world.removeObject(coin);
}
2. Created a class under actor(say text) i called the method(constructor) from my main class which displays the text in the terminal with System.out.println method. But its not displayed on the greenfoot world.
GreenfootImage m=new GreenfootImage(text, 28, Color.black, Color.White);
m.drawString(text,400,300);
setImage(m);
Someone help me with this..
