can i make a senario robot1 carring a item and moving to location1 then robot2 come and get that item from that robot1 and quickly go to the location1.(asuume that robot2 movement speed> robot1)..
Robot robot = (Robot)getOneIntersectingObject(Robot.class);
if (robot != null && robot.hasBarrel() && speed > robot.getSpeed())
{
robot.loseBarrel();
gainBarrel();
}Robot robot = new Robot(); // creating first robot robot.setSpeed(2); // setting speed of first robot addObject(robot, < wherever >); // add first robot into world robot = new Robot(); // creating second robot robot.setSpeed(3); // setting speed of second robot addObject(robot, < elsewhere >);
// instance field
private int speed;
// methods
public void setSpeed(int howFast);
{
speed = howFast;
}
public int getSpeed()
{
return speed;
}