Merge branch 'leereilly-twitter-summary-card' into gh-pages
This commit is contained in:
commit
5b2438dab3
21 changed files with 115 additions and 90 deletions
BIN
images/twitter-opengraph.png
Normal file
BIN
images/twitter-opengraph.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
50
index.html
50
index.html
|
@ -15,27 +15,38 @@
|
|||
<meta property="og:image" content="http://hextris.github.io/hextris/images/facebook-opengraph.png" />
|
||||
<meta property="og:image:width" content="1200" />
|
||||
<meta property="og:image:height" content="630" />
|
||||
<meta property="twitter:card" content="summary" />
|
||||
<meta property="twitter:site" content="@hextris" />
|
||||
<meta property="twitter:site:id" content="2742209678" />
|
||||
<meta property="twitter:creator" content="@hextris" />
|
||||
<meta property="twitter:creator:id" content="2742209678" />
|
||||
<meta property="twitter:domain" content="http://hextris.github.io" />
|
||||
<meta property="twitter:title" content="Hextris" />
|
||||
<meta property="twitter:description" content="An addictive puzzle game inspired by Tetris." />
|
||||
<meta property="twitter:image:src" content="http://hextris.github.io/hextris/images/twitter-opengraph.png" />
|
||||
<meta property="twitter:image:width" content="512" />
|
||||
<meta property="twitter:image:height" content="512" />
|
||||
<link rel="icon" type="image/png" href="favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="style/style.css">
|
||||
<link rel="stylesheet" href="style/fa/css/font-awesome.min.css">
|
||||
<script type = 'text/javascript' src="vendor_prod_v4/hammer.min.js"></script>
|
||||
<script type = 'text/javascript' src="vendor_prod_v4/jsonfn.min.js"></script>
|
||||
<script type = 'text/javascript' src="vendor_prod_v4/keypress.min.js"></script>
|
||||
<script type = 'text/javascript' src="vendor_prod_v4/jquery.js"></script>
|
||||
<script type = 'text/javascript' src="js_prod_v4/save-state.js"></script>
|
||||
<script type = 'text/javascript' src="js_prod_v4/view.js"></script>
|
||||
<script type = 'text/javascript' src="js_prod_v4/wavegen.js"></script>
|
||||
<script type = 'text/javascript' src="js_prod_v4/math.js"></script>
|
||||
<script type = 'text/javascript' src="js_prod_v4/Block.js"></script>
|
||||
<script type = 'text/javascript' src="js_prod_v4/Hex.js"></script>
|
||||
<script type = 'text/javascript' src="js_prod_v4/Text.js"></script>
|
||||
<script type = 'text/javascript' src="js_prod_v4/comboTimer.js"></script>
|
||||
<script type = 'text/javascript' src="js_prod_v4/checking.js"></script>
|
||||
<script type = 'text/javascript' src='js_prod_v4/update.js'></script>
|
||||
<script type = 'text/javascript' src='js_prod_v4/render.js'></script>
|
||||
<script type = 'text/javascript' src="js_prod_v4/input.js"></script>
|
||||
<script type = 'text/javascript' src="js_prod_v4/main.js"></script>
|
||||
<script type = 'text/javascript' src="js_prod_v4/initialization.js"></script>
|
||||
<script type = 'text/javascript' src="vendor_v6/hammer.min.js"></script>
|
||||
<script type = 'text/javascript' src="vendor_v6/jsonfn.min.js"></script>
|
||||
<script type = 'text/javascript' src="vendor_v6/keypress.min.js"></script>
|
||||
<script type = 'text/javascript' src="vendor_v6/jquery.js"></script>
|
||||
<script type = 'text/javascript' src="js_v6/save-state.js"></script>
|
||||
<script type = 'text/javascript' src="js_v6/view.js"></script>
|
||||
<script type = 'text/javascript' src="js_v6/wavegen.js"></script>
|
||||
<script type = 'text/javascript' src="js_v6/math.js"></script>
|
||||
<script type = 'text/javascript' src="js_v6/Block.js"></script>
|
||||
<script type = 'text/javascript' src="js_v6/Hex.js"></script>
|
||||
<script type = 'text/javascript' src="js_v6/Text.js"></script>
|
||||
<script type = 'text/javascript' src="js_v6/comboTimer.js"></script>
|
||||
<script type = 'text/javascript' src="js_v6/checking.js"></script>
|
||||
<script type = 'text/javascript' src='js_v6/update.js'></script>
|
||||
<script type = 'text/javascript' src='js_v6/render.js'></script>
|
||||
<script type = 'text/javascript' src="js_v6/input.js"></script>
|
||||
<script type = 'text/javascript' src="js_v6/main.js"></script>
|
||||
<script type = 'text/javascript' src="js_v6/initialization.js"></script>
|
||||
<script type = 'text/javascript' charset = 'utf-8' src = 'cordova.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -46,7 +57,8 @@
|
|||
js = d.createElement(s); js.id = id;
|
||||
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));</script>
|
||||
}(document, 'script', 'facebook-jssdk'));
|
||||
</script>
|
||||
<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>
|
||||
|
|
|
@ -46,7 +46,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
|
|||
MainHex.shakes.push({lane:tLane, magnitude:3 * (window.devicePixelRatio ? window.devicePixelRatio : 1) * (settings.scale)});
|
||||
}
|
||||
//fade out the opacity
|
||||
this.opacity = this.opacity - 0.075;
|
||||
this.opacity = this.opacity - 0.075 * MainHex.dt;
|
||||
if (this.opacity <= 0) {
|
||||
//slate for final deletion
|
||||
this.opacity = 0;
|
||||
|
@ -79,10 +79,10 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
|
|||
attached = false;
|
||||
|
||||
if(this.angle > this.targetAngle) {
|
||||
this.angularVelocity -= angularVelocityConst;
|
||||
this.angularVelocity -= angularVelocityConst * MainHex.dt;
|
||||
}
|
||||
else if(this.angle < this.targetAngle) {
|
||||
this.angularVelocity += angularVelocityConst;
|
||||
this.angularVelocity += angularVelocityConst * MainHex.dt;
|
||||
}
|
||||
|
||||
if (Math.abs(this.angle - this.targetAngle + this.angularVelocity) <= Math.abs(this.angularVelocity)) { //do better soon
|
||||
|
@ -102,6 +102,9 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
|
|||
var p4;
|
||||
if (this.initializing) {
|
||||
var rat = ((MainHex.ct - this.ict)/this.initLen);
|
||||
if (rat > 1) {
|
||||
rat = 1;
|
||||
}
|
||||
p1 = rotatePoint((-this.width / 2) * rat, this.height / 2, this.angle);
|
||||
p2 = rotatePoint((this.width / 2) * rat, this.height / 2, this.angle);
|
||||
p3 = rotatePoint((this.widthWide / 2) * rat, -this.height / 2, this.angle);
|
||||
|
@ -162,7 +165,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
|
|||
ctx.lineTo(baseX + p1.x, baseY + p1.y);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
this.tint -= 0.02;
|
||||
this.tint -= 0.02 * MainHex.dt;
|
||||
if (this.tint < 0) {
|
||||
this.tint = 0;
|
||||
}
|
|
@ -5,6 +5,7 @@ function Hex(sideLength) {
|
|||
this.angularVelocity = 0;
|
||||
this.position = 0;
|
||||
this.dy = 0;
|
||||
this.dt = 1;
|
||||
this.sides = 6;
|
||||
this.blocks = [];
|
||||
this.angle = 180 / this.sides;
|
||||
|
@ -31,7 +32,7 @@ function Hex(sideLength) {
|
|||
var dy = Math.sin(angle) * obj.magnitude;
|
||||
gdx -= dx;
|
||||
gdy += dy;
|
||||
obj.magnitude /= 2;
|
||||
obj.magnitude /= 2 * this.dt;
|
||||
if (obj.magnitude < 1) {
|
||||
for (var i = 0; i < this.shakes.length; i++) {
|
||||
if (this.shakes[i] == obj) {
|
||||
|
@ -63,7 +64,7 @@ function Hex(sideLength) {
|
|||
if (position !== undefined) {
|
||||
arr = tArr;
|
||||
if (position <= 0) {
|
||||
if (block.distFromHex - block.iter * settings.scale - (this.sideLength / 2) * Math.sqrt(3) <= 0) {
|
||||
if (block.distFromHex - block.iter * this.dt * settings.scale - (this.sideLength / 2) * Math.sqrt(3) <= 0) {
|
||||
block.distFromHex = (this.sideLength / 2) * Math.sqrt(3);
|
||||
block.settled = 1;
|
||||
block.checked = 1;
|
||||
|
@ -72,7 +73,7 @@ function Hex(sideLength) {
|
|||
block.iter = 1.5 + (waveone.difficulty/15) * 3;
|
||||
}
|
||||
} else {
|
||||
if (arr[position - 1].settled && block.distFromHex - block.iter * settings.scale - arr[position - 1].distFromHex - arr[position - 1].height <= 0) {
|
||||
if (arr[position - 1].settled && block.distFromHex - block.iter * this.dt * 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;
|
||||
|
@ -90,12 +91,12 @@ function Hex(sideLength) {
|
|||
var arr = this.blocks[lane];
|
||||
|
||||
if (arr.length > 0) {
|
||||
if (block.distFromHex + block.iter * settings.scale - arr[arr.length - 1].distFromHex - arr[arr.length - 1].height <= 0) {
|
||||
if (block.distFromHex + block.iter * this.dt * settings.scale - arr[arr.length - 1].distFromHex - arr[arr.length - 1].height <= 0) {
|
||||
block.distFromHex = arr[arr.length - 1].distFromHex + arr[arr.length - 1].height;
|
||||
this.addBlock(block);
|
||||
}
|
||||
} else {
|
||||
if (block.distFromHex + block.iter * settings.scale - (this.sideLength / 2) * Math.sqrt(3) <= 0) {
|
||||
if (block.distFromHex + block.iter * this.dt * settings.scale - (this.sideLength / 2) * Math.sqrt(3) <= 0) {
|
||||
block.distFromHex = (this.sideLength / 2) * Math.sqrt(3);
|
||||
this.addBlock(block);
|
||||
}
|
||||
|
@ -146,10 +147,10 @@ function Hex(sideLength) {
|
|||
this.shake(this.shakes[i]);
|
||||
}
|
||||
if (this.angle > this.targetAngle) {
|
||||
this.angularVelocity -= angularVelocityConst;
|
||||
this.angularVelocity -= angularVelocityConst * this.dt;
|
||||
}
|
||||
else if(this.angle < this.targetAngle) {
|
||||
this.angularVelocity += angularVelocityConst;
|
||||
this.angularVelocity += angularVelocityConst * this.dt;
|
||||
}
|
||||
|
||||
if (Math.abs(this.angle - this.targetAngle + this.angularVelocity) <= Math.abs(this.angularVelocity)) { //do better soon
|
|
@ -21,7 +21,7 @@ function Text(x,y,text,font,color,incrementFunction){
|
|||
}
|
||||
|
||||
function fadeUpAndOut(text){
|
||||
text.opacity -= Math.pow(Math.pow((1-text.opacity), 1/3)+1,3)/100;
|
||||
text.opacity -= MainHex.dt * Math.pow(Math.pow((1-text.opacity), 1/3)+1,3)/100;
|
||||
text.alive = text.opacity;
|
||||
text.y-=3;
|
||||
text.y -= 3 * MainHex.dt;
|
||||
}
|
|
@ -20,6 +20,7 @@ function hidebottombar() {
|
|||
}
|
||||
|
||||
function initialize(a) {
|
||||
window.lastTime = Date.now();
|
||||
window.iframHasLoaded = false;
|
||||
window.colors = ["#e74c3c", "#f1c40f", "#3498db", "#2ecc71"];
|
||||
window.hexColorsToTintedColors = {
|
|
@ -203,25 +203,27 @@ function setStartScreen() {
|
|||
gameState = 0;
|
||||
requestAnimFrame(animLoop);
|
||||
}
|
||||
setInterval(function(){
|
||||
if(gameState == 1 ){
|
||||
if(!MainHex.delay) {
|
||||
update();
|
||||
}
|
||||
else{
|
||||
MainHex.delay--;
|
||||
}
|
||||
}
|
||||
}, 17);
|
||||
|
||||
|
||||
function animLoop() {
|
||||
switch (gameState) {
|
||||
case 1:
|
||||
requestAnimFrame(animLoop);
|
||||
render();
|
||||
if (checkGameOver() && !importing) {
|
||||
var now = Date.now();
|
||||
var dt = (now - lastTime)/16.666;
|
||||
|
||||
if(gameState == 1 ){
|
||||
if(!MainHex.delay) {
|
||||
update(dt);
|
||||
}
|
||||
else{
|
||||
MainHex.delay--;
|
||||
}
|
||||
}
|
||||
|
||||
lastTime = now;
|
||||
|
||||
if (checkGameOver() && !importing) {
|
||||
var saveState = localStorage.getItem("saveState") || "{}";
|
||||
saveState = JSONfn.parse(saveState);
|
||||
gameState = 2;
|
||||
|
@ -246,10 +248,6 @@ function animLoop() {
|
|||
|
||||
case 0:
|
||||
requestAnimFrame(animLoop);
|
||||
if (importing) {
|
||||
update();
|
||||
}
|
||||
|
||||
render();
|
||||
break;
|
||||
|
||||
|
@ -259,9 +257,12 @@ function animLoop() {
|
|||
break;
|
||||
|
||||
case 2:
|
||||
var now = Date.now();
|
||||
var dt = (now - lastTime)/16.666;
|
||||
requestAnimFrame(animLoop);
|
||||
update();
|
||||
update(dt);
|
||||
render();
|
||||
lastTime = now;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
@ -282,6 +283,10 @@ function animLoop() {
|
|||
setStartScreen();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(gameState == 1 || gameState == 2)) {
|
||||
lastTime = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
function enableRestart() {
|
|
@ -1,10 +1,11 @@
|
|||
|
||||
//remember to update history function to show the respective iter speeds
|
||||
function update() {
|
||||
var now = MainHex.ct;
|
||||
function update(dt) {
|
||||
MainHex.dt = dt;
|
||||
if (gameState == 1) {
|
||||
waveone.update();
|
||||
if (now - waveone.prevTimeScored > 1000) {
|
||||
waveone.prevTimeScored = now;
|
||||
if (MainHex.ct - waveone.prevTimeScored > 1000) {
|
||||
waveone.prevTimeScored = MainHex.ct;
|
||||
}
|
||||
}
|
||||
var lowestDeletedIndex = 99;
|
||||
|
@ -16,7 +17,7 @@ function update() {
|
|||
for (i = 0; i < blocks.length; i++) {
|
||||
MainHex.doesBlockCollide(blocks[i]);
|
||||
if (!blocks[i].settled) {
|
||||
if (!blocks[i].initializing) blocks[i].distFromHex -= blocks[i].iter * settings.scale;
|
||||
if (!blocks[i].initializing) blocks[i].distFromHex -= blocks[i].iter * dt * settings.scale;
|
||||
} else if (!blocks[i].removed) {
|
||||
blocks[i].removed = 1;
|
||||
}
|
||||
|
@ -56,7 +57,7 @@ function update() {
|
|||
MainHex.doesBlockCollide(block, j, MainHex.blocks[i]);
|
||||
|
||||
if (!MainHex.blocks[i][j].settled) {
|
||||
MainHex.blocks[i][j].distFromHex -= block.iter * settings.scale;
|
||||
MainHex.blocks[i][j].distFromHex -= block.iter * dt * settings.scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,5 +68,6 @@ function update() {
|
|||
i--;
|
||||
}
|
||||
}
|
||||
MainHex.ct++;
|
||||
|
||||
MainHex.ct += dt;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
function blockDestroyed() {
|
||||
if (waveone.nextGen > 1350) {
|
||||
waveone.nextGen -= 24 * settings.creationSpeedModifier;
|
||||
waveone.nextGen -= 20 * settings.creationSpeedModifier;
|
||||
} else if (waveone.nextGen > 600) {
|
||||
waveone.nextGen -= 10 * settings.creationSpeedModifier;
|
||||
} else {
|
||||
|
@ -8,7 +8,7 @@ function blockDestroyed() {
|
|||
}
|
||||
|
||||
if (waveone.difficulty < 35) {
|
||||
waveone.difficulty += 0.17 * settings.speedModifier;
|
||||
waveone.difficulty += 0.11 * settings.speedModifier;
|
||||
} else {
|
||||
waveone.difficulty = 35;
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ function waveGen(hex) {
|
|||
this.dt = 0;
|
||||
this.update = function() {
|
||||
this.currentFunction();
|
||||
this.dt = MainHex.ct * 16.6666667;
|
||||
this.dt = (settings.platform == 'mobile' ? 10.0 : 15) * MainHex.ct;
|
||||
this.computeDifficulty();
|
||||
if ((this.dt - this.lastGen) * settings.creationSpeedModifier > this.nextGen) {
|
||||
if (this.nextGen > 600) {
|
||||
this.nextGen -= 10 * ((this.nextGen / 1300)) * settings.creationSpeedModifier;
|
||||
this.nextGen -= 14 * ((this.nextGen / 1300)) * settings.creationSpeedModifier;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -67,11 +67,11 @@ function waveGen(hex) {
|
|||
this.computeDifficulty = function() {
|
||||
if (this.difficulty < 35) {
|
||||
if (this.difficulty < 8) {
|
||||
this.difficulty += (this.dt - this.last) / (2566667) * settings.speedModifier;
|
||||
this.difficulty += (this.dt - this.last) / (2066667) * settings.speedModifier;
|
||||
} else if (this.difficulty < 15) {
|
||||
this.difficulty += (this.dt - this.last) / (53333333) * settings.speedModifier;
|
||||
this.difficulty += (this.dt - this.last) / (43333333) * settings.speedModifier;
|
||||
} else {
|
||||
this.difficulty += (this.dt - this.last) / (120000000) * settings.speedModifier;
|
||||
this.difficulty += (this.dt - this.last) / (90000000) * settings.speedModifier;
|
||||
}
|
||||
}
|
||||
};
|
|
@ -10,14 +10,14 @@
|
|||
}
|
||||
|
||||
.tweet {
|
||||
font-size:2em;
|
||||
font-size:2rem;
|
||||
color:#4099FF;
|
||||
}
|
||||
@media only screen
|
||||
and (min-device-width : 320px)
|
||||
and (max-device-width : 480px) {
|
||||
.tweet{
|
||||
font-size:1em;
|
||||
font-size:1rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,18 +190,19 @@ and (max-device-width : 480px) {
|
|||
}
|
||||
|
||||
.centeredHeader {
|
||||
font-size:5em;
|
||||
font-size:5vw;
|
||||
text-align:center;
|
||||
line-height:1em;
|
||||
line-height:4rem;
|
||||
}
|
||||
|
||||
.centeredSubHeader {
|
||||
font-size:2em;
|
||||
font-size:2.2rem;
|
||||
line-height:1em;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.centeredSubSubHeader {
|
||||
font-size:1.4em;
|
||||
font-size:1.4rem;
|
||||
text-align:center;
|
||||
}
|
||||
#attributions {
|
||||
|
@ -211,7 +212,7 @@ and (max-device-width : 480px) {
|
|||
left: 0%;
|
||||
top: 72%;
|
||||
text-align:center;
|
||||
font-size:1.25em;
|
||||
font-size:1.25rem;
|
||||
z-index:98;
|
||||
}
|
||||
|
||||
|
@ -219,17 +220,17 @@ and (max-device-width : 480px) {
|
|||
and (min-device-width : 320px)
|
||||
and (max-device-width : 580px) {
|
||||
.centeredHeader {
|
||||
font-size:2em;
|
||||
font-size:2rem;
|
||||
text-align:center;
|
||||
line-height:0.6em;
|
||||
line-height:0.6rem;
|
||||
}
|
||||
|
||||
#attributions {
|
||||
font-size:.7em;
|
||||
font-size:.7rem;
|
||||
}
|
||||
|
||||
.centeredSubHeader {
|
||||
font-size:1em;
|
||||
font-size:1rem;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue