Skip to content

Commit

Permalink
Added toggleMovement method in the RPGame class
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin Li committed Feb 20, 2015
1 parent 48ca7a1 commit 672224d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion MerchantRPGCSE2102/src/controller/RPGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class RPGame {
private Merchant _merchant1;
private Merchant _merchant2;
private Merchant _merchant3;
private boolean _movement;

public RPGame() {
//constructor
Expand Down Expand Up @@ -44,7 +45,7 @@ public void inventoryFromFile() {
merchantInventoryList1.add(item);
else if (currentMerchant == 2)
merchantInventoryList2.add(item);
else
else if (currentMerchant == 3)
merchantInventoryList3.add(item);
playerInventoryList.add(item);
}
Expand Down Expand Up @@ -100,4 +101,19 @@ public void createTransaction(Player player, Merchant targetMerchant)
Transaction newTransaction = new Transaction(player, targetMerchant);
newTransaction.runTransaction();
}

/**
* Toggles the movement on or off based on the input
*
* @param command either "ON" or "OFF"
*/
public void toggleMovement(String command)
{
if(command.equals("ON"))
_movement = true;
else if(command.equals("OFF"))
_movement = false;
else
System.out.println("Invalid movement toggle command");
}
}

0 comments on commit 672224d

Please sign in to comment.