please help me master, i want if papan get object example AAA we win.. I've tried but could not..
sorry if my english so bad.. :)
in here Actor A,F,L can move from left to right, and papan (rectangle) can move up and down.
SS :
public class papan extends Actor
{
/**
* Act - do whatever the papan wants to do. This method is called whenever the 'Act' or 'Run' button gets pressed in the environment.
*/
int counter =0;
int A = 0;
int L = 0;
int F = 0;
public void act()
{
counter = counter +1;
if (Greenfoot.isKeyDown("up"))
{
setLocation(getX(), getY()-10);
}
if (Greenfoot.isKeyDown("down"))
{
setLocation(getX(), getY()+10);
}
if(isTouching(a.class))
{
removeTouching(a.class);
//A=A +1;
Greenfoot.playSound("catch.wav");
}
if(isTouching(f.class))
{
//F=F +1;
Greenfoot.playSound("catch.wav");
}
if(isTouching(l.class))
{
//L=L +1;
Greenfoot.playSound("catch.wav");
}
if(counter == 20)
{
if(Greenfoot.getRandomNumber(2)==1)
{
getWorld().addObject ( new a(),0/*Greenfoot.getRandomNumber(100)*/,Greenfoot.getRandomNumber(700));
}
else
{
getWorld().addObject ( new f(),0/*Greenfoot.getRandomNumber(100)*/,Greenfoot.getRandomNumber(700));
}
counter =0;
}
/*if()
{
getWorld().addObject ( new gameover(),459,284); //on this gameover meaning win,just test.
Greenfoot.stop();
}*/
}
}

