Skip to content

Commit

Permalink
refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
asalga committed Dec 2, 2013
1 parent 0b5b63c commit 374eae9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
9 changes: 4 additions & 5 deletions BoardModel.pde
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public class BoardModel{

private int numGemsAllowedAtOnce;
private int numGemsOnBoard;
private ScreenGameplay screenGameplay;


/*
Instead of the board knowing how to draw itself, it
instead provides an iterator for the screen to render the tokens.
Expand Down Expand Up @@ -49,8 +48,8 @@ public class BoardModel{

/*
*/
public BoardModel(ScreenGameplay s){
screenGameplay = s;
public BoardModel(){
//screenGameplay = s;
numGemsOnBoard = 0;
numGemsAllowedAtOnce = 0;
board = new Token[BOARD_ROWS][BOARD_COLS];
Expand Down Expand Up @@ -436,7 +435,7 @@ public class BoardModel{
if(numTokensArrivedAtDest > 0){
markTokensForRemoval(START_ROW_INDEX, BOARD_ROWS-1);
if(removeMarkedTokens(true) > 2){
screenGameplay.test();
soundManager.playMatchSound();
}
dropTokens();
}
Expand Down
2 changes: 1 addition & 1 deletion Horadrix.pde
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,5 @@ public void keyReleased(){
}

public void stop(){
println("STOP TEST");
println("Stop test");
}
8 changes: 2 additions & 6 deletions ScreenGameplay.pde
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ public class ScreenGameplay implements IScreen, Subject{

private float opacity = 0.0;

public void test(){
//soundManager.playMatchSound();
}

/**
*/
public void addObserver(LayerObserver o){
Expand Down Expand Up @@ -104,7 +100,7 @@ public class ScreenGameplay implements IScreen, Subject{

Keyboard.lockKeys(new int[]{KEY_M});

boardModel = new BoardModel(this);
boardModel = new BoardModel();
boardModel.setNumGemsAllowedAtOnce(2);

debug = new Debugger();
Expand Down Expand Up @@ -641,7 +637,7 @@ public class ScreenGameplay implements IScreen, Subject{
}

// Easy way to clear the dying tokens which we don't want animating in the next level.
boardModel = new BoardModel(this);
boardModel = new BoardModel();
boardModel.setNumGemsAllowedAtOnce(2);

boardModel.generateNewBoardWithDyingAnimation(false);
Expand Down
2 changes: 1 addition & 1 deletion SoundManager.pde
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class SoundManager{

successSwapPlayer = new PlayerQueue("audio/success_swap.wav");
failSwapPlayer = new PlayerQueue("audio/fail_swap.wav");
matchPlayer = new PlayerQueue("audio/peg.wav");
matchPlayer = new PlayerQueue("audio/success_swap.wav");
}

public void setMute(boolean isMuted){
Expand Down

0 comments on commit 374eae9

Please sign in to comment.