added recording system

This commit is contained in:
lengstrom 2014-05-22 17:04:57 -04:00
parent 62326305f1
commit a740f1b60d
4 changed files with 26 additions and 5 deletions

View file

@ -14,6 +14,10 @@
color: white;
font-family: 'Roboto', sans-serif;
}
#clickToExit {
cursor:pointer;
}
</style>
</head>
<body style="background-color:#2c3e50">
@ -26,9 +30,13 @@
<div id="leftTap" style="position: absolute; left: 0; top: 0; height: 100%; width: 50%;"></div>
<div id="rightTap" style="position: absolute; right: 0; top: 0; height :100%; width: 50%;"></div>
<div id='devtools' style='z-index:3;display:none;position:absolute;left:50%;width:400px;height:400px;top:50%;margin-top:-200px;margin-left:-200px;'>
<h2 id = 'clickToExit' style = 'background-color:#fff;color:#000'>Click to exit</h2>
<textarea id ='devtoolsText' style = 'height:300px;width:400px;'></textarea>
</div>
<script type = 'text/javascript' src="vendor/hammer.min.js"></script>
<script type = 'text/javascript' src="vendor/keypress.min.js"></script>
<script type = 'text/javascript' src="vendor/jquery.js"></script>
<script type = 'text/javascript' src="js/view.js"></script>
<script type = 'text/javascript' src="js/wavegen.js"></script>
<script type = 'text/javascript' src="js/math.js"></script>

View file

@ -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();
}
});

View file

@ -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) {

View file

@ -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);