Skip to content

Commit

Permalink
refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
asalga committed Nov 24, 2013
1 parent 692d5fd commit 860b896
Show file tree
Hide file tree
Showing 10 changed files with 746 additions and 831 deletions.
588 changes: 588 additions & 0 deletions BoardModel.pde

Large diffs are not rendered by default.

37 changes: 24 additions & 13 deletions Horadrix.pde
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ final boolean SHOW_ALL_TOKENS = true;

// This includes the entire board, including the 'queued' tokens not visible
// to the user, that sit above the token the user interacts with.
// Rows should always be an even number since it gets divided by 2 (invisible part) and visible part
final int BOARD_COLS = 8;
final int BOARD_ROWS = 16;

// Only need y index
final int START_ROW_INDEX = 8;
final int START_ROW_INDEX = BOARD_ROWS/2;

final int TOKEN_SIZE = 32;

Expand All @@ -44,7 +45,17 @@ final int START_Y = (int)(CANVAS_HEIGHT/2.0f - BOARD_H_IN_PX/2.0f) + debugPosOff
// Used by the AssetStore
PApplet globalApplet;

Token[][] board = new Token[BOARD_ROWS][BOARD_COLS];

int numGemsOnBoard = 0;
// Tokens that have been remove from the board, but still need to be rendered for their
// death animation.
ArrayList<Token> dyingTokens;
// As the levels increase, more and more token types are added
// This makes it a slightly harder to match tokens.
int numTokenTypesOnBoard = 4;


BoardModel boardModel;

ScreenSet screens = new ScreenSet();
ScreenStory screenStory;
Expand All @@ -56,23 +67,14 @@ final int NUM_LEVELS = 4;
final int[] gemsRequired = new int[] {5, 10, 15, 20};
final float[] timePermitted = new float[]{5, 8, 14, 20};

/*
Wrap println so we can easily disable all console output on release
*/
void debugPrint(String str){
if(DEBUG_CONSOLE_ON){
println(str);
}
}

void setup(){
size(CANVAS_WIDTH, CANVAS_HEIGHT);

// The style of the game is pixel art, so we don't want anti-aliasing
noSmooth();

globalApplet = this;

// Start muted, because sound can be annoying.
soundManager = new SoundManager(globalApplet);
soundManager.init();
Expand All @@ -89,6 +91,15 @@ void setup(){
screens.transitionTo("splash");
}

/*
Don't use assert since that's a Java keyword
*/
void assertTest(boolean test, String errMsg){
if(test == false){
println(errMsg);
}
}

void update(){
screens.curr.update();
}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
build: minify

minify:
cat ScreenSet.pde ScreenWin.pde Stack.pde ScreenStory.pde Queue.pde ScreenGameOver.pde HUDLayer.pde IScreen.pde Subject.pde LayerObserver.pde SpriteSheetLoader.pde ScreenGameplay.pde ScreenSplash.pde Debugger.pde RetroFont.pde RetroLabel.pde RetroPanel.pde RetroWidget.pde Keyboard.pde Ticker.pde TokenType.pde Horadrix.pde SoundManager.js Token.pde Tuple.pde AssetStore.java IScreen.pde ScreenSplash.pde Utils.js ScreenGameplay.pde > Horadrix-min.pde
cat BoardModel.pde ScreenSet.pde ScreenWin.pde ScreenStory.pde ScreenGameOver.pde HUDLayer.pde IScreen.pde Subject.pde LayerObserver.pde SpriteSheetLoader.pde ScreenGameplay.pde ScreenSplash.pde Debugger.pde RetroFont.pde RetroLabel.pde RetroPanel.pde RetroWidget.pde Keyboard.pde Ticker.pde Horadrix.pde SoundManager.js Token.pde AssetStore.java IScreen.pde ScreenSplash.pde Utils.js ScreenGameplay.pde > Horadrix-min.pde

publish: minify
git add Horadrix-min.js
Expand Down
36 changes: 0 additions & 36 deletions Queue.pde

This file was deleted.

Loading

0 comments on commit 860b896

Please sign in to comment.