From a740f1b60df0683c0a2f15ebc0b74a1cd7ba84a3 Mon Sep 17 00:00:00 2001 From: lengstrom Date: Thu, 22 May 2014 17:04:57 -0400 Subject: [PATCH] added recording system --- index.html | 10 +++++++++- js/input.js | 9 ++++++++- js/main.js | 10 ++++++++-- js/wavegen.js | 2 +- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index ea76001..20aefba 100644 --- a/index.html +++ b/index.html @@ -14,6 +14,10 @@ color: white; font-family: 'Roboto', sans-serif; } + + #clickToExit { + cursor:pointer; + } @@ -26,9 +30,13 @@
- + + diff --git a/js/input.js b/js/input.js index c140c40..ee664ae 100644 --- a/js/input.js +++ b/js/input.js @@ -22,10 +22,17 @@ keypress.register_combo({ } }); +keypress.register_combo({ + keys: "q", + on_keydown: function() { + toggleDevTools(); + } +}); + keypress.register_combo({ keys: "e", on_keydown: function() { - alert(exportHistory()); + exportHistory(); } }); diff --git a/js/main.js b/js/main.js index 3913d9d..78adba7 100644 --- a/js/main.js +++ b/js/main.js @@ -15,6 +15,12 @@ window.requestAnimFrame = (function() { }; })(); +$('#clickToExit').bind('click', toggleDevTools); + +function toggleDevTools() { + $('#devtools').toggle(); +} + var gameState = 0; // 0 - start, 1 - playing, 2 - end var framerate = 60; var history = {}; @@ -84,11 +90,11 @@ function importHistory() { } function exportHistory() { - return JSON.stringify(history); + $('#devtoolsText').html(JSON.stringify(history)); + toggleDevTools(); } function update() { -<<<<<<< HEAD if (importing) { if (importedHistory[count]) { if (importedHistory[count].block) { diff --git a/js/wavegen.js b/js/wavegen.js index b038e8d..74b7c14 100644 --- a/js/wavegen.js +++ b/js/wavegen.js @@ -26,7 +26,7 @@ function waveGen(clock, start, jumps, simultaneousShots, colorJumps) { if(this.nextGen > 400){ this.nextGen -= 10 * ((this.nextGen - 200)/1000); } - blocks.push(new Block(this.jumps[0], colors[randInt(0, colors.length)])); + addNewBlock(this.jumps[0], colors[randInt(0, colors.length)]); } if (now - prevScore > 1000) { score += 5 * (scoreScalar * scoreAdditionCoeff);