Skip to content

Commit

Permalink
Initial countdown time is now configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
John Conomikes committed Sep 23, 2011
1 parent 7ed6f86 commit 7552995
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/html5/src/Dashboard.js
Expand Up @@ -56,8 +56,11 @@ var Dashboard = cocos.nodes.Node.extend({
this.set('penaltyTime', disp); this.set('penaltyTime', disp);
}, },


// Starts tracking time and updating the dashboard timer // Starts tracking time and updating the dashboard timer. Optionally set the initial countdown
start: function () { start: function (initialCountdown) {
if(initialCountdown) {
this.set('elapsedTime', -1 * initialCountdown)
}
this.scheduleUpdate(); this.scheduleUpdate();
}, },


Expand Down
7 changes: 7 additions & 0 deletions src/html5/src/RaceControl.js
Expand Up @@ -23,10 +23,17 @@ var RaceControl = BObject.extend({
}); });


RaceControl.finishLine = 3200; // Holds the z value of the finish line RaceControl.finishLine = 3200; // Holds the z value of the finish line
RaceControl.initialCountdown = 3000; // Initial countdown time in milliseconds

// <MEDALS>
RaceControl.times = [32, 42, 68, 100, 200]; // Holds [min, gold, silver, bronze, max] times RaceControl.times = [32, 42, 68, 100, 200]; // Holds [min, gold, silver, bronze, max] times

// <GlobalSpacing>
RaceControl.intermissionSpacing = 110; // Distance in meters from previous object to intermission RaceControl.intermissionSpacing = 110; // Distance in meters from previous object to intermission
RaceControl.questionSpacing = 150; // Distance in meters from previous object to question RaceControl.questionSpacing = 150; // Distance in meters from previous object to question
RaceControl.finishSpacing = 110; // Distance in meters after the last question to the finish line RaceControl.finishSpacing = 110; // Distance in meters after the last question to the finish line

// <PenaltySettings>
RaceControl.penaltyTime = 8; // Time in seconds lost for a incorrect answer RaceControl.penaltyTime = 8; // Time in seconds lost for a incorrect answer
RaceControl.penaltySpeed = -0.5; // Percentage speed LOST for an incorrect answer RaceControl.penaltySpeed = -0.5; // Percentage speed LOST for an incorrect answer


Expand Down
5 changes: 2 additions & 3 deletions src/html5/src/main.js
Expand Up @@ -413,12 +413,11 @@ var FluencyApp = KeyboardLayer.extend({
}, },


// Three second countdown before the game begins (after pressing the start button on the menu layer) // Three second countdown before the game begins (after pressing the start button on the menu layer)
// TODO: Make countdown configurable
// TODO: Make countdown more noticible // TODO: Make countdown more noticible
countdown: function () { countdown: function () {
this.get('dash').start(); this.get('dash').start(RC.initialCountdown / 1000);
this.get('dash').bindTo('speed', this.get('player'), 'zVelocity'); this.get('dash').bindTo('speed', this.get('player'), 'zVelocity');
setTimeout(this.startGame.bind(this), 3000); setTimeout(this.startGame.bind(this), RC.initialCountdown);
this.get('audioMixer').playSound('bg'); this.get('audioMixer').playSound('bg');
}, },


Expand Down

0 comments on commit 7552995

Please sign in to comment.