Merge branch 'gh-pages' of http://github.com/teamsnowman/hextris into gh-pages

Conflicts:
	index.html
This commit is contained in:
Garrett Finucane 2014-05-31 11:16:48 -04:00
commit 66fbad3cb5
7 changed files with 29 additions and 16 deletions

View file

@ -55,10 +55,10 @@
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<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>
<canvas id="canvas"></canvas>
<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/jsonfn.min.js"></script>
@ -102,6 +102,5 @@
</div>
<div onClick="showHelp()" id="openSideBar">?</div>
<div id="overlay" class="faded"></div>
</body>
</html>

View file

@ -24,7 +24,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
this.initializing = 1;
this.ct = 0;
//speed of block
this.iter = iter;
this.baseIter = iter;
//number of iterations before starting to drop
this.initLen = settings.creationDt;
//side which block is attached too
@ -66,6 +66,8 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
};
this.draw = function(attached, index) {
this.iter = this.baseIter * spaceModifier;
this.height = settings.blockHeight;
if (Math.abs(settings.scale - settings.prevScale) > .000000001) {
this.distFromHex *= (settings.scale/settings.prevScale);

View file

@ -63,7 +63,7 @@ function Clock(sideLength) {
if (block.distFromHex - block.iter * settings.scale - (this.sideLength / 2) * Math.sqrt(3) <= 0) {
block.distFromHex = (this.sideLength / 2) * Math.sqrt(3);
block.settled = 1;
block.checked=1;
block.checked = 1;
} else {
block.settled = 0;
}
@ -71,7 +71,7 @@ function Clock(sideLength) {
if (arr[position - 1].settled && block.distFromHex - block.iter * settings.scale - arr[position - 1].distFromHex - arr[position - 1].height <= 0) {
block.distFromHex = arr[position - 1].distFromHex + arr[position - 1].height;
block.settled = 1;
block.checked=1;
block.checked = 1;
}
else {
block.settled = 0;

View file

@ -12,17 +12,15 @@ function Text(x,y,text,font,color,incrementFunction){
ctx.font= this.font;
ctx.fillStyle = this.color;
ctx.globalAlpha = this.opacity;
ctx.fillText(text,this.x+gdx,this.y+gdy);
ctx.fillText(this.text,this.x+gdx,this.y+gdy);
ctx.globalAlpha =1;
//this.opacity = 1-(Date.now()-MainClock.lastCombo)/5000;
incrementFunction(this);
return true;
}
else{
else {
return false;
}
}
}

View file

@ -72,6 +72,16 @@ keypress.register_combo({
importHistory();
}
});
keypress.register_combo({
keys: "space",
on_keydown: function() {
spaceModifier = 2;
},
on_keyup: function() {
spaceModifier = 1;
}
});
keypress.register_combo({
keys: "enter",
on_keydown: function() {

View file

@ -1,5 +1,5 @@
pauseText = true;
showingHelp = false;
var pauseText = true;
var showingHelp = false;
$(document).ready(scaleCanvas);
$(window).resize(scaleCanvas);
$(window).unload(function() {
@ -98,6 +98,7 @@ var isGameOver = 3;
var scoreAdditionCoeff = 1;
var prevScore = 0;
var numHighScores = 3;
var spaceModifier = 1;
var highscores = [0, 0, 0];
if(localStorage.getItem('highscores'))
@ -157,9 +158,10 @@ function init() {
gdx = saveState.gdx || 0;
gdy = saveState.gdy || 0;
comboMultiplier = saveState.comboMultiplier || 0;
comboMultiplier = saveState.comboMultiplier || 0;
MainClock = saveState.clock || new Clock(settings.hexWidth);
for(var i=0; i<MainClock.blocks.length; i++) {
for(var j=0; j<MainClock.blocks[i].length; j++) {
var block = MainClock.blocks[i][j];
@ -173,6 +175,8 @@ function init() {
startTime = Date.now();
waveone = saveState.wavegen || new waveGen(MainClock,Date.now(),[1,1,0],[1,1],[1,1]);
MainClock.texts = []; //clear texts
clearSaveState();
}

View file

@ -9,7 +9,7 @@ function exportSaveState() {
wavegen: waveone,
gdx: gdx,
gdy: gdy,
comboMultiplier:comboMultiplier
comboMultiplier:comboMultiplier
}
}