Permalink
Browse files

Merge branch 'master' of git@github.com:talah/BBTH

  • Loading branch information...
2 parents e7aa3b0 + ead7861 commit a1b0efa88e16794d94eab760de20be80960ce44f @greywhind greywhind committed May 17, 2011
@@ -57,6 +57,7 @@
private static final Random random = new Random();
private boolean serverReady;
private boolean clientReady;
+ private float startingCountdown = 3;
// This is the virtual size of the game
public static final float GAME_X = BeatTrack.BEAT_TRACK_WIDTH;
@@ -290,7 +291,10 @@ protected void update(float seconds) {
}
if (gameState == GameState.WAITING_TO_START) {
- gameState = GameState.IN_PROGRESS;
+ startingCountdown -= seconds;
+ if (startingCountdown < 0) {
+ gameState = GameState.IN_PROGRESS;
+ }
}
// DON'T ADVANCE THE SIMULATION WHEN WE AREN'T PLAYING
@@ -562,6 +566,10 @@ private void explodeBase(Team team) {
serverPlayer.base.drawFill = false;
}
}
+
+ public float getStartingCountdown() {
+ return startingCountdown;
+ }
private BaseDestroyedEvent baseDestroyedEvent;
private GameEndedEvent endEvent;
@@ -191,6 +191,16 @@ public void onDraw(Canvas canvas) {
paint.setTextSize(20);
canvas.drawText("Waiting for other player...", BBTHSimulation.GAME_X + BBTHSimulation.GAME_WIDTH / 2, BBTHSimulation.GAME_Y
+ BBTHSimulation.GAME_HEIGHT / 2, paint);
+ } else {
+ float countdown = sim.getStartingCountdown();
+ int number = (int) Math.ceil(countdown);
+ if (number > 0) {
+ float alpha = countdown - (int) countdown;
+ paint.setARGB((int) (alpha * 255), 255, 255, 255);
+ paint.setTextSize(100);
+ canvas.drawText(Integer.toString(number), BBTHSimulation.GAME_X + BBTHSimulation.GAME_WIDTH / 2, BBTHSimulation.GAME_Y
+ + BBTHSimulation.GAME_HEIGHT / 2 + 30, paint);
+ }
}
float percent = (System.currentTimeMillis() - tap_location_hint_time) / (float)TAP_HINT_DISPLAY_LENGTH;
@@ -303,7 +313,7 @@ public void onUpdate(float seconds) {
}
// Start the music
- if (setSong && sim.isReady() && !beatTrack.isPlaying()) {
+ if (setSong && sim.getGameState() == GameState.IN_PROGRESS && !beatTrack.isPlaying()) {
beatTrack.startMusic();
}
@@ -39,11 +39,16 @@
private static final Path path = new Path();
private static final Paint paint = new Paint();
public static final float MIN_SONG_TIME = -6;
- public static final boolean USE_OK_BUTTONS = false;
static {
paint.setAntiAlias(true);
}
+ /**
+ * If this is true, there will be an OK button after most text prompts to
+ * give people enough time to digest the message.
+ */
+ public static final boolean USE_OK_BUTTONS = false;
+
private abstract class Step extends UIView implements UIButtonDelegate {
@Override
public boolean containsPoint(float x, float y) {
@@ -315,7 +320,7 @@ public void onClick(UIButton button) {
transition(new FinishedStep());
}
}
-
+
private class FinishedStep extends Step {
}

0 comments on commit a1b0efa

Please sign in to comment.