Hi ! I am trying to make a robot that will scan the page and find where the bomb is and automatically push it to the redbricks square/rectangle... this is the code
public void act()
{
//move(20);
if (getX()==595)
{
turn(180);
}
else if (getX()==99)
{
turn(180);
Greenfoot.stop();
}
if (Greenfoot.isKeyDown("left"))
{
turn(-3);
}
if (Greenfoot.isKeyDown("right"))
{
turn(3);
}
if (Greenfoot.isKeyDown("up"))
{
move(5);
}
}
public boolean foundBomb()
{
return getOneObjectAtOffset(0, 0, bomb_1.class) !=null;
}
}
can anyone help please? I kind of figured out how to make it push the bomb to the square using the keyboard but it is not working properly, the main concern is how to make it scan the page using the act button and then it will do everything... can anyone help please?

