Skip to content

Commit

Permalink
Changed the way in which the player detected a transaction was available
Browse files Browse the repository at this point in the history
from a merchant. The transaction can now be initiated by pressing the
'f' key when within 1 vertex of the merchant.
  • Loading branch information
john committed Apr 11, 2015
1 parent 0541699 commit 7f6dded
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion MerchantRPGCSE2102/src/controller/RPGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class RPGame {
private ArrayList<String> playerInventoryList = new ArrayList<String>(); // the player's inventory list
private Player _player;
private Merchant _merchant1, _merchant2, _merchant3;
public boolean _movement;
public boolean _movement = true;
private int _currentDay;
private int _transactionLimit;

Expand Down
3 changes: 2 additions & 1 deletion MerchantRPGCSE2102/src/sprites/PlayerSprite.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ public void keyReleased(KeyEvent e) {
dy = 0;
}
if (e.getKeyCode() == KeyEvent.VK_F){
if(collision()){
if((mapui.getMap().collisionTo("east"))||(mapui.getMap().collisionTo("west"))||(mapui.getMap().collisionTo("south"))||(mapui.getMap().collisionTo("north"))||(mapui.getMap().collisionTo("northeast"))||(mapui.getMap().collisionTo("northwest"))||(mapui.getMap().collisionTo("southeast"))||(mapui.getMap().collisionTo("southwest"))){
System.out.println("Transaction starting"); // For testing purposes
mapui.game.createTransaction(null, null);//RPGame initialize Trade
}
else{
Expand Down
4 changes: 2 additions & 2 deletions MerchantRPGCSE2102/src/view/MapUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class MapUI extends JPanel {
public Map map;
private PlayerSprite player;
private ArrayList<MerchantSprite> merchants = new ArrayList<MerchantSprite>();
private boolean _tranState=game._movement;



public MapUI(Map map,RPGame Game) {
Expand Down Expand Up @@ -114,7 +114,7 @@ public void changeState(){
*/
public void move() {
//check transaction
if (_tranState=false){
if (game._movement==false){

}
else{
Expand Down

0 comments on commit 7f6dded

Please sign in to comment.