
back 2
By:
ace on
Jul 28th, 2010 | syntax:
None | size: 0.81 KB | hits: 15 | expires: Never
private void back()
{
String reverseLastDirection = "";
Command backCommand = new Command("go", reverseLastDirection);
if(lastDirection=="north")
{
reverseLastDirection = "south";
backCommand = ("go", reverseLastDirection);
goRoom(backCommand);
if(lastDirection == "east")
{
reverseLastDirection = "west";
goRoom(backCommand);
}
if(lastDirection == "south")
{
reverseLastDirection = "north";
goRoom(backCommand);
}
if (lastDirection == "west")
{
reverseLastDirection = "east";
goRoom(backCommand);
}
}