What is up the the '*2's?
public class Player2 extends Actor
{
private int limit = 2;
private int steps = 1;
/**
*
*/
public void act()
{
move();
}
public void move()
{
move(1);
steps = steps *2;
if (steps == limit)
{
turn (180);
steps = 0;
limit = limit *2;
}
TouchingTreasure();
}
public void TouchingTreasure()
{
Actor treasure = getOneObjectAtOffset(0, 0, Treasure.class);
if (treasure !=null)
{
System.out.println("Good Job! You found the treasure!");
Greenfoot.stop();
}
}
public int getLimit()
{
return limit;
}
}public class Player2 extends Actor
{
private int limit = 2;
private int steps = 1;
/**
*
*/
public void act()
{
move();
}
public void move()
{
move(1);
steps = steps + 1;
if (steps == limit)
{
turn (180);
steps = 0;
limit = limit*2;
}
TouchingTreasure();
}
public void TouchingTreasure()
{
Actor treasure = getOneObjectAtOffset(0, 0, Treasure.class);
if (treasure !=null)
{
System.out.println("Good Job! You found the treasure!");
Greenfoot.stop();
}
}
public int getLimit()
{
return limit;
}
} public class Player2 extends Actor
{
private int limit = 1;
private int steps = 0;
private int time = 0;
/**
*
*/
public void act()
{
move();
}
public void move()
{
move(1);
steps = steps + 1;
if (steps == limit)
{
turn (180);
steps = 0;
limit = limit*2;
}
TouchingTreasure();
time = time + 1;
}
public void TouchingTreasure()
{
Actor treasure = getOneObjectAtOffset(0, 0, Treasure.class);
if (treasure !=null)
{
System.out.println("Good Job Player 2! You have found the Treasure after: " + time/60);
getWorld().removeObject (this);
}
}
public int getLimit()
{
return time;
}
}