xchanged tabs

This commit is contained in:
lengstrom 2015-05-24 10:54:12 -04:00
parent 7d85fe4dcc
commit 5cf1d12128
23 changed files with 1242 additions and 1242 deletions

View file

@ -553,31 +553,31 @@ to the start of each source file to most effectively state the exclusion of warr
and each file should have at least the “copyright” line and a pointer to and each file should have at least the “copyright” line and a pointer to
where the full notice is found. where the full notice is found.
<one line to give the program's name and a brief idea of what it does.> <one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author> Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this If the program does terminal interaction, make it output a short notice like this
when it starts in an interactive mode: when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author> <program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it
under certain conditions; type 'show c' for details. under certain conditions; type 'show c' for details.
The hypothetical commands 'show w' and 'show c' should show the appropriate parts of The hypothetical commands 'show w' and 'show c' should show the appropriate parts of
the General Public License. Of course, your program's commands might be different; the General Public License. Of course, your program's commands might be different;

View file

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch --> <!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
<title>Back button</title> <title>Back button</title>
<desc>Created with Sketch.</desc> <desc>Created with Sketch.</desc>
<defs></defs> <defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="About" sketch:type="MSArtboardGroup" transform="translate(-10.000000, -10.000000)"> <g id="About" sketch:type="MSArtboardGroup" transform="translate(-10.000000, -10.000000)">
<g id="Back-button" sketch:type="MSLayerGroup" transform="translate(10.000000, 5.000000)"> <g id="Back-button" sketch:type="MSLayerGroup" transform="translate(10.000000, 5.000000)">
<polygon id="Back-hex" fill="#FFFFFF" sketch:type="MSShapeGroup" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon> <polygon id="Back-hex" fill="#FFFFFF" sketch:type="MSShapeGroup" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon>
<path d="M52,36.25 L30.7025,36.25 L40.47625,26.47625 L38,24 L24,38 L38,52 L40.47625,49.52375 L30.7025,39.75 L52,39.75 L52,36.25 L52,36.25 Z" id="Back-arrow" fill="#2C3E50" sketch:type="MSShapeGroup"></path> <path d="M52,36.25 L30.7025,36.25 L40.47625,26.47625 L38,24 L24,38 L38,52 L40.47625,49.52375 L30.7025,39.75 L52,39.75 L52,36.25 L52,36.25 Z" id="Back-arrow" fill="#2C3E50" sketch:type="MSShapeGroup"></path>
</g> </g>
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch --> <!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
<title>Facebook</title> <title>Facebook</title>
<desc>Created with Sketch.</desc> <desc>Created with Sketch.</desc>
<defs></defs> <defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="Start-screen" sketch:type="MSArtboardGroup" transform="translate(-143.000000, -530.000000)"> <g id="Start-screen" sketch:type="MSArtboardGroup" transform="translate(-143.000000, -530.000000)">
<g id="Help-+-Social" sketch:type="MSLayerGroup" transform="translate(48.000000, 525.000000)"> <g id="Help-+-Social" sketch:type="MSLayerGroup" transform="translate(48.000000, 525.000000)">
<g id="Social" transform="translate(95.000000, 0.000000)" sketch:type="MSShapeGroup"> <g id="Social" transform="translate(95.000000, 0.000000)" sketch:type="MSShapeGroup">
<g id="Facebook"> <g id="Facebook">
<polygon id="Score-hex-2" fill="#3C5B9A" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon> <polygon id="Score-hex-2" fill="#3C5B9A" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon>
<path d="M43.093578,27.9857143 L46,27.9857143 L46,23.2142857 C45.5009174,23.1428571 43.7834862,23 41.7724771,23 C37.5889908,23 34.7266055,25.4857143 34.7266055,30.0428571 L34.7266055,33.9714286 L30,33.9714286 L30,39.3 L34.7266055,39.3 L34.7266055,53 L40.3779817,53 L40.3779817,39.3142857 L45.0899083,39.3142857 L45.7944954,33.9857143 L40.3779817,33.9857143 L40.3779817,30.5714286 C40.3779817,29.0285714 40.8183486,27.9857143 43.093578,27.9857143 L43.093578,27.9857143 Z" id="Shape" fill="#FFFFFF"></path> <path d="M43.093578,27.9857143 L46,27.9857143 L46,23.2142857 C45.5009174,23.1428571 43.7834862,23 41.7724771,23 C37.5889908,23 34.7266055,25.4857143 34.7266055,30.0428571 L34.7266055,33.9714286 L30,33.9714286 L30,39.3 L34.7266055,39.3 L34.7266055,53 L40.3779817,53 L40.3779817,39.3142857 L45.0899083,39.3142857 L45.7944954,33.9857143 L40.3779817,33.9857143 L40.3779817,30.5714286 C40.3779817,29.0285714 40.8183486,27.9857143 43.093578,27.9857143 L43.093578,27.9857143 Z" id="Shape" fill="#FFFFFF"></path>
</g> </g>
</g> </g>
</g> </g>
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch --> <!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
<title>Help</title> <title>Help</title>
<desc>Created with Sketch.</desc> <desc>Created with Sketch.</desc>
<defs></defs> <defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="Start-screen" sketch:type="MSArtboardGroup" transform="translate(-48.000000, -530.000000)"> <g id="Start-screen" sketch:type="MSArtboardGroup" transform="translate(-48.000000, -530.000000)">
<g id="Help-+-Social" sketch:type="MSLayerGroup" transform="translate(48.000000, 525.000000)"> <g id="Help-+-Social" sketch:type="MSLayerGroup" transform="translate(48.000000, 525.000000)">
<g id="Help" sketch:type="MSShapeGroup"> <g id="Help" sketch:type="MSShapeGroup">
<polygon id="Score-hex-4" fill="#BDC3C7" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon> <polygon id="Score-hex-4" fill="#BDC3C7" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon>
<path d="M29.1793249,28.7921348 L29,25.8075843 C29.2151909,25.7607676 29.6097018,25.6846915 30.1835443,25.5793539 C30.7573868,25.4740163 31.1459202,25.4096443 31.3491561,25.386236 C31.552392,25.3628276 31.9110382,25.3160116 32.4251055,25.2457865 C32.9391728,25.1755614 33.3874805,25.1287454 33.7700422,25.1053371 C34.1526039,25.0819287 34.6547086,25.0585207 35.2763713,25.0351124 C35.8980341,25.011704 36.567507,25 37.2848101,25 C39.7953712,25 41.6663089,25.4447521 42.8976793,26.3342697 C44.1290498,27.2237872 44.7447257,28.5931555 44.7447257,30.4424157 C44.7447257,31.4021584 44.5355155,32.2858106 44.1170886,33.0933989 C43.6986618,33.9009872 43.1846022,34.6090794 42.5748945,35.2176966 C41.9651868,35.8263139 41.3554883,36.4466261 40.7457806,37.0786517 C40.1360729,37.7106773 39.5981036,38.4831415 39.1318565,39.3960674 C38.6656095,40.3089933 38.3966248,41.3155376 38.3248945,42.4157303 L34.7025316,42.4157303 C34.6786215,41.2453125 34.8400123,40.1626922 35.1867089,39.1678371 C35.5334054,38.1729819 35.9697583,37.3419977 36.4957806,36.6748596 C37.0218029,36.0077214 37.5537948,35.3815572 38.0917722,34.7963483 C38.6297495,34.2111394 39.101967,33.6200873 39.5084388,33.0231742 C39.9149106,32.4262611 40.1300983,31.8352089 40.1540084,31.25 C40.2018286,30.3136657 39.9208891,29.6289816 39.3111814,29.195927 C38.7014737,28.7628724 37.7032418,28.5463483 36.3164557,28.5463483 C34.4036473,28.5463483 32.0246274,28.6282763 29.1793249,28.7921348 L29.1793249,28.7921348 Z M35.9936709,45.1896067 L37.0337553,45.1896067 C37.6315079,45.1896067 38.043951,45.3007948 38.271097,45.5231742 C38.498243,45.7455535 38.6118143,46.1376376 38.6118143,46.6994382 L38.6118143,48.4901685 C38.6118143,49.0519691 38.498243,49.4440532 38.271097,49.6664326 C38.043951,49.888812 37.6315079,50 37.0337553,50 L35.9936709,50 C35.3959182,50 34.9834751,49.888812 34.7563291,49.6664326 C34.5291831,49.4440532 34.4156118,49.0519691 34.4156118,48.4901685 L34.4156118,46.6994382 C34.4156118,46.1376376 34.5291831,45.7455535 34.7563291,45.5231742 C34.9834751,45.3007948 35.3959182,45.1896067 35.9936709,45.1896067 L35.9936709,45.1896067 Z" id="?" fill="#FFFFFF"></path> <path d="M29.1793249,28.7921348 L29,25.8075843 C29.2151909,25.7607676 29.6097018,25.6846915 30.1835443,25.5793539 C30.7573868,25.4740163 31.1459202,25.4096443 31.3491561,25.386236 C31.552392,25.3628276 31.9110382,25.3160116 32.4251055,25.2457865 C32.9391728,25.1755614 33.3874805,25.1287454 33.7700422,25.1053371 C34.1526039,25.0819287 34.6547086,25.0585207 35.2763713,25.0351124 C35.8980341,25.011704 36.567507,25 37.2848101,25 C39.7953712,25 41.6663089,25.4447521 42.8976793,26.3342697 C44.1290498,27.2237872 44.7447257,28.5931555 44.7447257,30.4424157 C44.7447257,31.4021584 44.5355155,32.2858106 44.1170886,33.0933989 C43.6986618,33.9009872 43.1846022,34.6090794 42.5748945,35.2176966 C41.9651868,35.8263139 41.3554883,36.4466261 40.7457806,37.0786517 C40.1360729,37.7106773 39.5981036,38.4831415 39.1318565,39.3960674 C38.6656095,40.3089933 38.3966248,41.3155376 38.3248945,42.4157303 L34.7025316,42.4157303 C34.6786215,41.2453125 34.8400123,40.1626922 35.1867089,39.1678371 C35.5334054,38.1729819 35.9697583,37.3419977 36.4957806,36.6748596 C37.0218029,36.0077214 37.5537948,35.3815572 38.0917722,34.7963483 C38.6297495,34.2111394 39.101967,33.6200873 39.5084388,33.0231742 C39.9149106,32.4262611 40.1300983,31.8352089 40.1540084,31.25 C40.2018286,30.3136657 39.9208891,29.6289816 39.3111814,29.195927 C38.7014737,28.7628724 37.7032418,28.5463483 36.3164557,28.5463483 C34.4036473,28.5463483 32.0246274,28.6282763 29.1793249,28.7921348 L29.1793249,28.7921348 Z M35.9936709,45.1896067 L37.0337553,45.1896067 C37.6315079,45.1896067 38.043951,45.3007948 38.271097,45.5231742 C38.498243,45.7455535 38.6118143,46.1376376 38.6118143,46.6994382 L38.6118143,48.4901685 C38.6118143,49.0519691 38.498243,49.4440532 38.271097,49.6664326 C38.043951,49.888812 37.6315079,50 37.0337553,50 L35.9936709,50 C35.3959182,50 34.9834751,49.888812 34.7563291,49.6664326 C34.5291831,49.4440532 34.4156118,49.0519691 34.4156118,48.4901685 L34.4156118,46.6994382 C34.4156118,46.1376376 34.5291831,45.7455535 34.7563291,45.5231742 C34.9834751,45.3007948 35.3959182,45.1896067 35.9936709,45.1896067 L35.9936709,45.1896067 Z" id="?" fill="#FFFFFF"></path>
</g> </g>
</g> </g>
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch --> <!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
<title>Pause button</title> <title>Pause button</title>
<desc>Created with Sketch.</desc> <desc>Created with Sketch.</desc>
<defs></defs> <defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="New-game" sketch:type="MSArtboardGroup" transform="translate(-275.000000, -565.000000)"> <g id="New-game" sketch:type="MSArtboardGroup" transform="translate(-275.000000, -565.000000)">
<g id="Pause-button" sketch:type="MSLayerGroup" transform="translate(275.000000, 560.000000)"> <g id="Pause-button" sketch:type="MSLayerGroup" transform="translate(275.000000, 560.000000)">
<polygon id="Pause-hex" fill="#FFFFFF" sketch:type="MSShapeGroup" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon> <polygon id="Pause-hex" fill="#FFFFFF" sketch:type="MSShapeGroup" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon>
<path d="M26,52 L34,52 L34,24 L26,24 L26,52 L26,52 Z M42,24 L42,52 L50,52 L50,24 L42,24 L42,24 Z" id="Pause-shape" fill="#2C3E50" sketch:type="MSShapeGroup"></path> <path d="M26,52 L34,52 L34,24 L26,24 L26,52 L26,52 Z M42,24 L42,52 L50,52 L50,24 L42,24 L42,24 Z" id="Pause-shape" fill="#2C3E50" sketch:type="MSShapeGroup"></path>
</g> </g>
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch --> <!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
<title>Restart button</title> <title>Restart button</title>
<desc>Created with Sketch.</desc> <desc>Created with Sketch.</desc>
<defs></defs> <defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="Paused" sketch:type="MSArtboardGroup" transform="translate(-10.000000, -565.000000)"> <g id="Paused" sketch:type="MSArtboardGroup" transform="translate(-10.000000, -565.000000)">
<g id="Restart-button" sketch:type="MSLayerGroup" transform="translate(10.000000, 560.000000)"> <g id="Restart-button" sketch:type="MSLayerGroup" transform="translate(10.000000, 560.000000)">
<polygon id="Score-hex-4" fill="#F1C40F" sketch:type="MSShapeGroup" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon> <polygon id="Score-hex-4" fill="#F1C40F" sketch:type="MSShapeGroup" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon>
<path d="M47.8849281,28.1125 C45.3545966,25.575 41.8611632,24 37.9912445,24 C30.2514071,24 24,30.265 24,38 C24,45.735 30.2514071,52 37.9912445,52 C44.5140713,52 49.9774859,47.5375 51.5272045,41.5 L47.8849281,41.5 C46.4402752,45.5775 42.5703565,48.5 37.9912445,48.5 C32.1863665,48.5 27.4846779,43.80125 27.4846779,38 C27.4846779,32.19875 32.1863665,27.5 37.9912445,27.5 C40.8893058,27.5 43.4896811,28.7075 45.3896185,30.60625 L39.742339,36.25 L52,36.25 L52,24 L47.8849281,28.1125 L47.8849281,28.1125 Z" id="Shape" fill="#FFFFFF" sketch:type="MSShapeGroup"></path> <path d="M47.8849281,28.1125 C45.3545966,25.575 41.8611632,24 37.9912445,24 C30.2514071,24 24,30.265 24,38 C24,45.735 30.2514071,52 37.9912445,52 C44.5140713,52 49.9774859,47.5375 51.5272045,41.5 L47.8849281,41.5 C46.4402752,45.5775 42.5703565,48.5 37.9912445,48.5 C32.1863665,48.5 27.4846779,43.80125 27.4846779,38 C27.4846779,32.19875 32.1863665,27.5 37.9912445,27.5 C40.8893058,27.5 43.4896811,28.7075 45.3896185,30.60625 L39.742339,36.25 L52,36.25 L52,24 L47.8849281,28.1125 L47.8849281,28.1125 Z" id="Shape" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
</g> </g>
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch --> <!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
<title>Resume button</title> <title>Resume button</title>
<desc>Created with Sketch.</desc> <desc>Created with Sketch.</desc>
<defs></defs> <defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="Paused" sketch:type="MSArtboardGroup" transform="translate(-275.000000, -565.000000)"> <g id="Paused" sketch:type="MSArtboardGroup" transform="translate(-275.000000, -565.000000)">
<g id="Resume-button" sketch:type="MSLayerGroup" transform="translate(275.000000, 560.000000)"> <g id="Resume-button" sketch:type="MSLayerGroup" transform="translate(275.000000, 560.000000)">
<polygon id="Pause-hex" fill="#FFFFFF" sketch:type="MSShapeGroup" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon> <polygon id="Pause-hex" fill="#FFFFFF" sketch:type="MSShapeGroup" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon>
<path d="M26,24 L26,52 L49,38 L26,24 Z" id="Play-icon" fill="#2C3E50" sketch:type="MSShapeGroup"></path> <path d="M26,24 L26,52 L49,38 L26,24 Z" id="Play-icon" fill="#2C3E50" sketch:type="MSShapeGroup"></path>
</g> </g>
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="255px" height="65px" viewBox="0 0 255 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <svg width="255px" height="65px" viewBox="0 0 255 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch --> <!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
<title>Share button</title> <title>Share button</title>
<desc>Created with Sketch.</desc> <desc>Created with Sketch.</desc>
<defs></defs> <defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="Game-over-" sketch:type="MSArtboardGroup" transform="translate(-95.000000, -565.000000)"> <g id="Game-over-" sketch:type="MSArtboardGroup" transform="translate(-95.000000, -565.000000)">
<g id="Share-button" sketch:type="MSLayerGroup" transform="translate(95.000000, 565.000000)"> <g id="Share-button" sketch:type="MSLayerGroup" transform="translate(95.000000, 565.000000)">
<polygon id="Score-hex-2" fill="#3498DB" sketch:type="MSShapeGroup" transform="translate(127.661316, 32.500000) rotate(-90.000000) translate(-127.661316, -32.500000) " points="127.661316 -94.814636 160.137269 -76.064636 160.137269 141.064636 127.661317 159.814636 95.185364 141.064636 95.1853635 -76.064636 "></polygon> <polygon id="Score-hex-2" fill="#3498DB" sketch:type="MSShapeGroup" transform="translate(127.661316, 32.500000) rotate(-90.000000) translate(-127.661316, -32.500000) " points="127.661316 -94.814636 160.137269 -76.064636 160.137269 141.064636 127.661317 159.814636 95.185364 141.064636 95.1853635 -76.064636 "></polygon>
<text id="SHARE-MY-SCORE!" sketch:type="MSTextLayer" font-family="Exo 2" font-size="16" font-weight="420" fill="#FFFFFF"> <text id="SHARE-MY-SCORE!" sketch:type="MSTextLayer" font-family="Exo 2" font-size="16" font-weight="420" fill="#FFFFFF">
<tspan x="67" y="39">SHARE MY SCORE!</tspan> <tspan x="67" y="39">SHARE MY SCORE!</tspan>
</text> </text>
</g> </g>
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <svg width="75px" height="65px" viewBox="0 0 75 65" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch --> <!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
<title>Twitter</title> <title>Twitter</title>
<desc>Created with Sketch.</desc> <desc>Created with Sketch.</desc>
<defs></defs> <defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="Start-screen" sketch:type="MSArtboardGroup" transform="translate(-238.000000, -530.000000)"> <g id="Start-screen" sketch:type="MSArtboardGroup" transform="translate(-238.000000, -530.000000)">
<g id="Help-+-Social" sketch:type="MSLayerGroup" transform="translate(48.000000, 525.000000)"> <g id="Help-+-Social" sketch:type="MSLayerGroup" transform="translate(48.000000, 525.000000)">
<g id="Social" transform="translate(95.000000, 0.000000)" sketch:type="MSShapeGroup"> <g id="Social" transform="translate(95.000000, 0.000000)" sketch:type="MSShapeGroup">
<g id="Twitter" transform="translate(95.000000, 0.000000)"> <g id="Twitter" transform="translate(95.000000, 0.000000)">
<polygon id="Score-hex-3" fill="#55ACEE" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon> <polygon id="Score-hex-3" fill="#55ACEE" transform="translate(37.500000, 37.500000) rotate(-90.000000) translate(-37.500000, -37.500000) " points="37.5 0 69.9759526 18.75 69.9759526 56.25 37.5 75 5.02404736 56.25 5.02404736 18.75 "></polygon>
<path d="M53,27.9545455 C51.9041096,28.4615385 50.7054795,28.7937063 49.4726027,28.951049 C50.739726,28.1643357 51.7157534,26.9405594 52.1780822,25.4545455 C50.9965753,26.1713287 49.6780822,26.6958042 48.2739726,26.993007 C47.1609589,25.7692308 45.5513699,25 43.7876712,25 C40.3972603,25 37.640411,27.8321678 37.640411,31.3111888 C37.640411,31.8006993 37.6917808,32.2902098 37.7945205,32.7447552 C32.6917808,32.4825175 28.1541096,29.965035 25.1232877,26.1538462 C24.5924658,27.0804196 24.2842466,28.1643357 24.2842466,29.3181818 C24.2842466,31.5034965 25.3630137,33.4440559 27.0239726,34.5629371 C26.0136986,34.527972 25.0719178,34.2482517 24.2328767,33.7762238 L24.2328767,33.8636364 C24.2328767,36.9230769 26.3561644,39.4755245 29.1643836,40.0524476 C28.6506849,40.1923077 28.1027397,40.2797203 27.5376712,40.2797203 C27.1438356,40.2797203 26.75,40.2447552 26.3732877,40.1748252 C27.1609589,42.6748252 29.4212329,44.5104895 32.109589,44.5629371 C30.0034247,46.2587413 27.3493151,47.2727273 24.4726027,47.2727273 C23.9760274,47.2727273 23.4794521,47.2377622 23,47.1853147 C25.7568493,48.951049 28.9931507,50 32.4520548,50 C43.7534247,50 49.9520548,40.3846154 49.9520548,32.0454545 C49.9520548,31.7657343 49.9520548,31.5034965 49.9349315,31.2237762 C51.1335616,30.3321678 52.1780822,29.2307692 53,27.9545455 L53,27.9545455 Z" id="Shape" fill="#FFFFFF"></path> <path d="M53,27.9545455 C51.9041096,28.4615385 50.7054795,28.7937063 49.4726027,28.951049 C50.739726,28.1643357 51.7157534,26.9405594 52.1780822,25.4545455 C50.9965753,26.1713287 49.6780822,26.6958042 48.2739726,26.993007 C47.1609589,25.7692308 45.5513699,25 43.7876712,25 C40.3972603,25 37.640411,27.8321678 37.640411,31.3111888 C37.640411,31.8006993 37.6917808,32.2902098 37.7945205,32.7447552 C32.6917808,32.4825175 28.1541096,29.965035 25.1232877,26.1538462 C24.5924658,27.0804196 24.2842466,28.1643357 24.2842466,29.3181818 C24.2842466,31.5034965 25.3630137,33.4440559 27.0239726,34.5629371 C26.0136986,34.527972 25.0719178,34.2482517 24.2328767,33.7762238 L24.2328767,33.8636364 C24.2328767,36.9230769 26.3561644,39.4755245 29.1643836,40.0524476 C28.6506849,40.1923077 28.1027397,40.2797203 27.5376712,40.2797203 C27.1438356,40.2797203 26.75,40.2447552 26.3732877,40.1748252 C27.1609589,42.6748252 29.4212329,44.5104895 32.109589,44.5629371 C30.0034247,46.2587413 27.3493151,47.2727273 24.4726027,47.2727273 C23.9760274,47.2727273 23.4794521,47.2377622 23,47.1853147 C25.7568493,48.951049 28.9931507,50 32.4520548,50 C43.7534247,50 49.9520548,40.3846154 49.9520548,32.0454545 C49.9520548,31.7657343 49.9520548,31.5034965 49.9349315,31.2237762 C51.1335616,30.3321678 52.1780822,29.2307692 53,27.9545455 L53,27.9545455 Z" id="Shape" fill="#FFFFFF"></path>
</g> </g>
</g> </g>
</g> </g>
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="36px" height="19px" viewBox="0 0 36 19" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"> <svg width="36px" height="19px" viewBox="0 0 36 19" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch --> <!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
<title>Arrows icon</title> <title>Arrows icon</title>
<desc>Created with Sketch.</desc> <desc>Created with Sketch.</desc>
<defs></defs> <defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="New-game" sketch:type="MSArtboardGroup" transform="translate(-162.000000, -146.000000)" fill="#2C3E50"> <g id="New-game" sketch:type="MSArtboardGroup" transform="translate(-162.000000, -146.000000)" fill="#2C3E50">
<g id="Tutorial" sketch:type="MSLayerGroup" transform="translate(50.000000, 96.000000)"> <g id="Tutorial" sketch:type="MSLayerGroup" transform="translate(50.000000, 96.000000)">
<path d="M130,47.49 L136.34,53.83 L139.17,51 L130,41.83 L120.83,51 L123.66,53.83 L130,47.49 L130,47.49 Z M130,72.17 L123.66,65.83 L120.83,68.66 L130,77.83 L139.17,68.66 L136.34,65.83 L130,72.17 L130,72.17 Z" id="Arrows-icon" sketch:type="MSShapeGroup" transform="translate(130.000000, 59.830000) rotate(-90.000000) translate(-130.000000, -59.830000) "></path> <path d="M130,47.49 L136.34,53.83 L139.17,51 L130,41.83 L120.83,51 L123.66,53.83 L130,47.49 L130,47.49 Z M130,72.17 L123.66,65.83 L120.83,68.66 L130,77.83 L139.17,68.66 L136.34,65.83 L130,72.17 L130,72.17 Z" id="Arrows-icon" sketch:type="MSShapeGroup" transform="translate(130.000000, 59.830000) rotate(-90.000000) translate(-130.000000, -59.830000) "></path>
</g> </g>
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -73,8 +73,8 @@
</div> </div>
<div class="faded overlay"></div> <div class="faded overlay"></div>
<div id="attributions"> <div id="attributions">
<a href = 'https://itunes.apple.com/us/app/id903769553?mt=8'><b>iOS</b></a> <a href ='https://play.google.com/store/apps/details?id=com.hextris.hextris'><b>Android</b></a><br> <a href = 'https://itunes.apple.com/us/app/id903769553?mt=8'><b>iOS</b></a> <a href ='https://play.google.com/store/apps/details?id=com.hextris.hextris'><b>Android</b></a><br>
By <a href="http://loganengstrom.com/" target="_blank">Logan Engstrom</a> & <a href='garrettdreyfus.github.io' target="_blank">Garrett Finucane</a> By <a href="http://loganengstrom.com/" target="_blank">Logan Engstrom</a> & <a href='garrettdreyfus.github.io' target="_blank">Garrett Finucane</a>
</div> </div>
<div id='startBtn' style='position:absolute;left:40%;top:38%;height:25%;width:25%;z-index:99999999;cursor:pointer;'></div> <div id='startBtn' style='position:absolute;left:40%;top:38%;height:25%;width:25%;z-index:99999999;cursor:pointer;'></div>
<div id="helpScreen" class = 'unselectable'> <div id="helpScreen" class = 'unselectable'>
@ -97,5 +97,5 @@
<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-51272720-2', 'auto'); ga('send', 'pageview'); <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-51272720-2', 'auto'); ga('send', 'pageview');
</script> </script>
<a href="https://github.com/hextris/hextris"><img id="fork-ribbon" style="position: absolute; top: 0; right: 0; border: 0;z-index:100000000;" src="https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"></a> <a href="https://github.com/hextris/hextris"><img id="fork-ribbon" style="position: absolute; top: 0; right: 0; border: 0;z-index:100000000;" src="https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"></a>
</body> </body>
</html> </html>

View file

@ -5,7 +5,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
//the lane which the block was shot from //the lane which the block was shot from
this.fallingLane = fallingLane; this.fallingLane = fallingLane;
this.checked=0; this.checked=0;
//the angle at which the block falls //the angle at which the block falls
this.angle = 90 - (30 + 60 * fallingLane); this.angle = 90 - (30 + 60 * fallingLane);
//for calculating the rotation of blocks attached to the center hex //for calculating the rotation of blocks attached to the center hex
@ -92,7 +92,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
else { else {
this.angle += this.angularVelocity; this.angle += this.angularVelocity;
} }
this.width = 2 * this.distFromHex / Math.sqrt(3); this.width = 2 * this.distFromHex / Math.sqrt(3);
this.widthWide = 2 * (this.distFromHex + this.height) / Math.sqrt(3); this.widthWide = 2 * (this.distFromHex + this.height) / Math.sqrt(3);
//this.widthWide = this.width + this.height + 3; //this.widthWide = this.width + this.height + 3;

View file

@ -17,10 +17,10 @@ function Hex(sideLength) {
this.y = trueCanvas.height / 2; this.y = trueCanvas.height / 2;
this.ct = 0; this.ct = 0;
this.lastCombo = this.ct - settings.comboTime; this.lastCombo = this.ct - settings.comboTime;
this.lastColorScored = "#000"; this.lastColorScored = "#000";
this.comboTime = 1; this.comboTime = 1;
this.texts = []; this.texts = [];
this.lastRotate = Date.now(); this.lastRotate = Date.now();
for (var i = 0; i < this.sides; i++) { for (var i = 0; i < this.sides; i++) {
this.blocks.push([]); this.blocks.push([]);
} }
@ -53,7 +53,7 @@ function Hex(sideLength) {
block.distFromHex = MainHex.sideLength / 2 * Math.sqrt(3) + block.height * this.blocks[lane].length; block.distFromHex = MainHex.sideLength / 2 * Math.sqrt(3) + block.height * this.blocks[lane].length;
this.blocks[lane].push(block); this.blocks[lane].push(block);
block.attachedLane = lane; block.attachedLane = lane;
block.checked = 1; block.checked = 1;
}; };
this.doesBlockCollide = function(block, position, tArr) { this.doesBlockCollide = function(block, position, tArr) {
@ -67,7 +67,7 @@ function Hex(sideLength) {
if (block.distFromHex - block.iter * this.dt * 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.distFromHex = (this.sideLength / 2) * Math.sqrt(3);
block.settled = 1; block.settled = 1;
block.checked = 1; block.checked = 1;
} else { } else {
block.settled = 0; block.settled = 0;
block.iter = 1.5 + (waveone.difficulty/15) * 3; block.iter = 1.5 + (waveone.difficulty/15) * 3;
@ -105,7 +105,7 @@ function Hex(sideLength) {
}; };
this.rotate = function(steps) { this.rotate = function(steps) {
if(Date.now()-this.lastRotate<75 && !(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) ) return; if(Date.now()-this.lastRotate<75 && !(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) ) return;
if (!(gameState === 1 || gameState === 0)) return; if (!(gameState === 1 || gameState === 0)) return;
this.position += steps; this.position += steps;
if (!history[this.ct]) { if (!history[this.ct]) {
@ -131,7 +131,7 @@ function Hex(sideLength) {
}); });
this.targetAngle = this.targetAngle - steps * 60; this.targetAngle = this.targetAngle - steps * 60;
this.lastRotate = Date.now(); this.lastRotate = Date.now();
}; };
this.draw = function() { this.draw = function() {
@ -166,5 +166,5 @@ function Hex(sideLength) {
} }
function arrayToColor(arr){ function arrayToColor(arr){
return 'rgb(' + arr[0]+ ','+arr[1]+','+arr[2]+')'; return 'rgb(' + arr[0]+ ','+arr[1]+','+arr[2]+')';
} }

View file

@ -79,6 +79,6 @@ function consolidateBlocks(hex,side,index){
} }
var adder = deleting.length * deleting.length * hex.comboMultiplier; var adder = deleting.length * deleting.length * hex.comboMultiplier;
hex.texts.push(new Text(hex.x,hex.y,"+ "+adder.toString(),"bold Q ",deletedBlocks[0].color,fadeUpAndOut)); hex.texts.push(new Text(hex.x,hex.y,"+ "+adder.toString(),"bold Q ",deletedBlocks[0].color,fadeUpAndOut));
hex.lastColorScored = deletedBlocks[0].color; hex.lastColorScored = deletedBlocks[0].color;
score += adder; score += adder;
} }

View file

@ -1,13 +1,13 @@
function drawTimer() { function drawTimer() {
if(gameState==1){ if(gameState==1){
var leftVertexes = []; var leftVertexes = [];
var rightVertexes = []; var rightVertexes = [];
if(MainHex.ct - MainHex.lastCombo < settings.comboTime){ if(MainHex.ct - MainHex.lastCombo < settings.comboTime){
for(var i=0;i<6;i++){ for(var i=0;i<6;i++){
var done = (MainHex.ct -MainHex.lastCombo); var done = (MainHex.ct -MainHex.lastCombo);
if(done<(settings.comboTime)*(5-i)*(1/6)){ if(done<(settings.comboTime)*(5-i)*(1/6)){
leftVertexes.push(calcSide(i,i+1,1,1)); leftVertexes.push(calcSide(i,i+1,1,1));
rightVertexes.push(calcSide(12-i,11-i,1,1)); rightVertexes.push(calcSide(12-i,11-i,1,1));
} }
else{ else{
leftVertexes.push(calcSide(i,i+1,1-((done*6)/settings.comboTime)%(1),1)); leftVertexes.push(calcSide(i,i+1,1-((done*6)/settings.comboTime)%(1),1));
@ -16,8 +16,8 @@ function drawTimer() {
} }
} }
} }
if(rightVertexes.length !== 0) drawSide(rightVertexes); if(rightVertexes.length !== 0) drawSide(rightVertexes);
if(leftVertexes.length !== 0) drawSide(leftVertexes); if(leftVertexes.length !== 0) drawSide(leftVertexes);
} }
} }
@ -49,7 +49,7 @@ function calcSide(startVertex,endVertex,fraction,offset){
var startY =trueCanvas.height/2 + Vertexes[startVertex][1]; var startY =trueCanvas.height/2 + Vertexes[startVertex][1];
var endX = trueCanvas.width/2 + Vertexes[endVertex][0]; var endX = trueCanvas.width/2 + Vertexes[endVertex][0];
var endY = trueCanvas.height/2 + Vertexes[endVertex][1]; var endY = trueCanvas.height/2 + Vertexes[endVertex][1];
return [[startX,startY],[((endX-startX)*fraction)+startX,((endY-startY)*fraction)+startY]]; return [[startX,startY],[((endX-startX)*fraction)+startX,((endY-startY)*fraction)+startY]];
} }
function drawSide(vertexes){ function drawSide(vertexes){
if (gameState === 0) { if (gameState === 0) {
@ -58,12 +58,12 @@ function drawSide(vertexes){
ctx.strokeStyle = MainHex.lastColorScored; ctx.strokeStyle = MainHex.lastColorScored;
} }
ctx.lineWidth =4*settings.scale; ctx.lineWidth =4*settings.scale;
ctx.moveTo(vertexes[0][0][0],vertexes[0][0][1]); ctx.moveTo(vertexes[0][0][0],vertexes[0][0][1]);
ctx.lineTo(vertexes[0][1][0],vertexes[0][1][1]); ctx.lineTo(vertexes[0][1][0],vertexes[0][1][1]);
for(var i=1;i<vertexes.length;i++){ for(var i=1;i<vertexes.length;i++){
ctx.lineTo(vertexes[i][1][0],vertexes[i][1][1]); ctx.lineTo(vertexes[i][1][0],vertexes[i][1][1]);
ctx.moveTo(vertexes[i][1][0],vertexes[i][1][1]); ctx.moveTo(vertexes[i][1][0],vertexes[i][1][1]);
} }
ctx.closePath(); ctx.closePath();
ctx.fill(); ctx.fill();
ctx.stroke(); ctx.stroke();

View file

@ -1,325 +1,325 @@
$(document).ready(function() { $(document).ready(function() {
initialize(); initialize();
$('#bottombar').hide(); $('#bottombar').hide();
}); });
function showbottombar() { function showbottombar() {
var isOffline = 'onLine' in navigator && !navigator.onLine; var isOffline = 'onLine' in navigator && !navigator.onLine;
if (isOffline) { if (isOffline) {
setTimeout(showbottombar, 1000); setTimeout(showbottombar, 1000);
} else { } else {
window.iframeHasLoaded = true; window.iframeHasLoaded = true;
if (gameState != 1) { if (gameState != 1) {
$('#bottombar').fadeIn(150, 'linear'); $('#bottombar').fadeIn(150, 'linear');
} }
} }
} }
function hidebottombar() { function hidebottombar() {
$('#bottombar').fadeOut(150, 'linear'); $('#bottombar').fadeOut(150, 'linear');
} }
function initialize(a) { function initialize(a) {
window.rush = 1; window.rush = 1;
window.lastTime = Date.now(); window.lastTime = Date.now();
window.iframHasLoaded = false; window.iframHasLoaded = false;
window.colors = ["#e74c3c", "#f1c40f", "#3498db", "#2ecc71"]; window.colors = ["#e74c3c", "#f1c40f", "#3498db", "#2ecc71"];
window.hexColorsToTintedColors = { window.hexColorsToTintedColors = {
"#e74c3c": "rgb(241,163,155)", "#e74c3c": "rgb(241,163,155)",
"#f1c40f": "rgb(246,223,133)", "#f1c40f": "rgb(246,223,133)",
"#3498db": "rgb(151,201,235)", "#3498db": "rgb(151,201,235)",
"#2ecc71": "rgb(150,227,183)" "#2ecc71": "rgb(150,227,183)"
}; };
window.rgbToHex = { window.rgbToHex = {
"rgb(231,76,60)": "#e74c3c", "rgb(231,76,60)": "#e74c3c",
"rgb(241,196,15)": "#f1c40f", "rgb(241,196,15)": "#f1c40f",
"rgb(52,152,219)": "#3498db", "rgb(52,152,219)": "#3498db",
"rgb(46,204,113)": "#2ecc71" "rgb(46,204,113)": "#2ecc71"
}; };
window.rgbColorsToTintedColors = { window.rgbColorsToTintedColors = {
"rgb(231,76,60)": "rgb(241,163,155)", "rgb(231,76,60)": "rgb(241,163,155)",
"rgb(241,196,15)": "rgb(246,223,133)", "rgb(241,196,15)": "rgb(246,223,133)",
"rgb(52,152,219)": "rgb(151,201,235)", "rgb(52,152,219)": "rgb(151,201,235)",
"rgb(46,204,113)": "rgb(150,227,183)" "rgb(46,204,113)": "rgb(150,227,183)"
}; };
window.hexagonBackgroundColor = 'rgb(236, 240, 241)'; window.hexagonBackgroundColor = 'rgb(236, 240, 241)';
window.hexagonBackgroundColorClear = 'rgba(236, 240, 241, 0.5)'; window.hexagonBackgroundColorClear = 'rgba(236, 240, 241, 0.5)';
window.centerBlue = 'rgb(44,62,80)'; window.centerBlue = 'rgb(44,62,80)';
window.angularVelocityConst = 4; window.angularVelocityConst = 4;
window.scoreOpacity = 0; window.scoreOpacity = 0;
window.textOpacity = 0; window.textOpacity = 0;
window.prevGameState = undefined; window.prevGameState = undefined;
//render.js //render.js
window.op = 0; window.op = 0;
window.saveState = localStorage.getItem("saveState") || "{}"; window.saveState = localStorage.getItem("saveState") || "{}";
if (saveState !== "{}") { if (saveState !== "{}") {
op = 1; op = 1;
} }
//input.js //input.js
//all of main.js //all of main.js
//main.js //main.js
window.textShown = false; window.textShown = false;
window.requestAnimFrame = (function() { window.requestAnimFrame = (function() {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
window.setTimeout(callback, 1000 / framerate); window.setTimeout(callback, 1000 / framerate);
}; };
})(); })();
$('#clickToExit').bind('click', toggleDevTools); $('#clickToExit').bind('click', toggleDevTools);
window.settings; window.settings;
if (/Mobile|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { if (/Mobile|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
settings = { settings = {
os: "other", os: "other",
platform: "mobile", platform: "mobile",
startDist: 227, startDist: 227,
creationDt: 60, creationDt: 60,
baseScale: 1.4, baseScale: 1.4,
scale: 1, scale: 1,
prevScale: 1, prevScale: 1,
baseHexWidth: 87, baseHexWidth: 87,
hexWidth: 87, hexWidth: 87,
baseBlockHeight: 20, baseBlockHeight: 20,
blockHeight: 20, blockHeight: 20,
rows: 7, rows: 7,
speedModifier: 0.73, speedModifier: 0.73,
creationSpeedModifier: 0.73, creationSpeedModifier: 0.73,
comboTime: 240 comboTime: 240
}; };
} else { } else {
settings = { settings = {
os: "other", os: "other",
platform: "nonmobile", platform: "nonmobile",
baseScale: 1, baseScale: 1,
startDist: 340, startDist: 340,
creationDt: 9, creationDt: 9,
scale: 1, scale: 1,
prevScale: 1, prevScale: 1,
hexWidth: 65, hexWidth: 65,
baseHexWidth: 87, baseHexWidth: 87,
baseBlockHeight: 20, baseBlockHeight: 20,
blockHeight: 15, blockHeight: 15,
rows: 8, rows: 8,
speedModifier: 0.65, speedModifier: 0.65,
creationSpeedModifier: 0.65, creationSpeedModifier: 0.65,
comboTime: 240 comboTime: 240
}; };
$("#inst_main_body").html("The goal of Hextris is to stop blocks from leaving the inside of the outer gray hexagon<br><br>" + (settings.platform != 'mobile' ? 'Press the right and left arrow keys' : 'tap the left and right sides of the screen') + " to rotate the Hexagon<br><br>Clear blocks and get points by making 3 or more blocks of the same color touch<br><br>Time left before your combo streak disappears is indicated shown by <span style='color:#f1c40f;'>the</span> <span style='color:#e74c3c'>colored</span> <span style='color:#3498db'>lines</span> <span style='color:#2ecc71'>in</span> the outer hexagon<br><br> " + (settings.platform == 'mobile' ? 'Toggle speeding up the game by tapping the inner hexagon' : "Speed up the game 2x by holding the down arrow")); $("#inst_main_body").html("The goal of Hextris is to stop blocks from leaving the inside of the outer gray hexagon<br><br>" + (settings.platform != 'mobile' ? 'Press the right and left arrow keys' : 'tap the left and right sides of the screen') + " to rotate the Hexagon<br><br>Clear blocks and get points by making 3 or more blocks of the same color touch<br><br>Time left before your combo streak disappears is indicated shown by <span style='color:#f1c40f;'>the</span> <span style='color:#e74c3c'>colored</span> <span style='color:#3498db'>lines</span> <span style='color:#2ecc71'>in</span> the outer hexagon<br><br> " + (settings.platform == 'mobile' ? 'Toggle speeding up the game by tapping the inner hexagon' : "Speed up the game 2x by holding the down arrow"));
} }
if(/Android/i.test(navigator.userAgent)) { if(/Android/i.test(navigator.userAgent)) {
settings.os = "android"; settings.os = "android";
} }
if(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i)){ if(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i)){
settings.os="ios"; settings.os="ios";
} }
window.canvas = document.getElementById('canvas'); window.canvas = document.getElementById('canvas');
window.ctx = canvas.getContext('2d'); window.ctx = canvas.getContext('2d');
window.trueCanvas = { window.trueCanvas = {
width: canvas.width, width: canvas.width,
height: canvas.height height: canvas.height
}; };
scaleCanvas(); scaleCanvas();
window.framerate = 60; window.framerate = 60;
window.history = {}; window.history = {};
window.score = 0; window.score = 0;
window.isGameOver = 3; window.isGameOver = 3;
window.scoreAdditionCoeff = 1; window.scoreAdditionCoeff = 1;
window.prevScore = 0; window.prevScore = 0;
window.numHighScores = 3; window.numHighScores = 3;
highscores = []; highscores = [];
if (localStorage.getItem('highscores')) { if (localStorage.getItem('highscores')) {
try { try {
highscores = JSON.parse(localStorage.getItem('highscores')); highscores = JSON.parse(localStorage.getItem('highscores'));
} catch (e) { } catch (e) {
highscores = []; highscores = [];
} }
} }
window.blocks = []; window.blocks = [];
window.MainHex; window.MainHex;
window.gdx = 0; window.gdx = 0;
window.gdy = 0; window.gdy = 0;
window.devMode = 0; window.devMode = 0;
window.lastGen = undefined; window.lastGen = undefined;
window.prevTimeScored = undefined; window.prevTimeScored = undefined;
window.nextGen = undefined; window.nextGen = undefined;
window.spawnLane = 0; window.spawnLane = 0;
window.importing = 0; window.importing = 0;
window.importedHistory = undefined; window.importedHistory = undefined;
window.startTime = undefined; window.startTime = undefined;
window.gameState; window.gameState;
setStartScreen(); setStartScreen();
if (a != 1) { if (a != 1) {
window.canRestart = 1; window.canRestart = 1;
window.onblur = function(e) { window.onblur = function(e) {
if (gameState == 1) { if (gameState == 1) {
pause(); pause();
} }
}; };
$('#startBtn').off(); $('#startBtn').off();
if (settings.platform == 'mobile') { if (settings.platform == 'mobile') {
$('#startBtn').on('touchstart', startBtnHandler); $('#startBtn').on('touchstart', startBtnHandler);
} else { } else {
$('#startBtn').on('mousedown', startBtnHandler); $('#startBtn').on('mousedown', startBtnHandler);
} }
document.addEventListener('touchmove', function(e) { document.addEventListener('touchmove', function(e) {
e.preventDefault(); e.preventDefault();
}, false); }, false);
$(window).resize(scaleCanvas); $(window).resize(scaleCanvas);
$(window).unload(function() { $(window).unload(function() {
if (gameState == 1 || gameState == -1 || gameState === 0) localStorage.setItem("saveState", exportSaveState()); if (gameState == 1 || gameState == -1 || gameState === 0) localStorage.setItem("saveState", exportSaveState());
else localStorage.setItem("saveState", "{}"); else localStorage.setItem("saveState", "{}");
}); });
addKeyListeners(); addKeyListeners();
(function(i, s, o, g, r, a, m) { (function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() { i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments) (i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); }, i[r].l = 1 * new Date();
a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a = s.createElement(o), m = s.getElementsByTagName(o)[0];
a.async = 1; a.async = 1;
a.src = g; a.src = g;
m.parentNode.insertBefore(a, m) m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-51272720-1', 'teamsnowman.github.io'); ga('create', 'UA-51272720-1', 'teamsnowman.github.io');
ga('send', 'pageview'); ga('send', 'pageview');
document.addEventListener("pause", handlePause, false); document.addEventListener("pause", handlePause, false);
document.addEventListener("backbutton", handlePause, false); document.addEventListener("backbutton", handlePause, false);
document.addEventListener("menubutton", handlePause, false); //menu button on android document.addEventListener("menubutton", handlePause, false); //menu button on android
setTimeout(function() { setTimeout(function() {
if (settings.platform == "mobile") { if (settings.platform == "mobile") {
try { try {
document.body.removeEventListener('touchstart', handleTapBefore, false); document.body.removeEventListener('touchstart', handleTapBefore, false);
} catch (e) { } catch (e) {
} }
try { try {
document.body.removeEventListener('touchstart', handleTap, false); document.body.removeEventListener('touchstart', handleTap, false);
} catch (e) { } catch (e) {
} }
document.body.addEventListener('touchstart', handleTapBefore, false); document.body.addEventListener('touchstart', handleTapBefore, false);
} else { } else {
try { try {
document.body.removeEventListener('mousedown', handleClickBefore, false); document.body.removeEventListener('mousedown', handleClickBefore, false);
} catch (e) { } catch (e) {
} }
try { try {
document.body.removeEventListener('mousedown', handleClick, false); document.body.removeEventListener('mousedown', handleClick, false);
} catch (e) { } catch (e) {
} }
document.body.addEventListener('mousedown', handleClickBefore, false); document.body.addEventListener('mousedown', handleClickBefore, false);
} }
}, 1); }, 1);
} }
} }
function startBtnHandler() { function startBtnHandler() {
setTimeout(function() { setTimeout(function() {
if (settings.platform == "mobile") { if (settings.platform == "mobile") {
try { try {
document.body.removeEventListener('touchstart', handleTapBefore, false); document.body.removeEventListener('touchstart', handleTapBefore, false);
} catch (e) { } catch (e) {
} }
try { try {
document.body.removeEventListener('touchstart', handleTap, false); document.body.removeEventListener('touchstart', handleTap, false);
} catch (e) { } catch (e) {
} }
document.body.addEventListener('touchstart', handleTap, false); document.body.addEventListener('touchstart', handleTap, false);
} else { } else {
try { try {
document.body.removeEventListener('mousedown', handleClickBefore, false); document.body.removeEventListener('mousedown', handleClickBefore, false);
} catch (e) { } catch (e) {
} }
try { try {
document.body.removeEventListener('mousedown', handleClick, false); document.body.removeEventListener('mousedown', handleClick, false);
} catch (e) { } catch (e) {
} }
document.body.addEventListener('mousedown', handleClick, false); document.body.addEventListener('mousedown', handleClick, false);
} }
}, 5); }, 5);
if (!canRestart) return false; if (!canRestart) return false;
if ($('#helpScreen').is(':visible')) { if ($('#helpScreen').is(':visible')) {
$('#helpScreen').fadeOut(150, "linear"); $('#helpScreen').fadeOut(150, "linear");
} }
if (importing == 1) { if (importing == 1) {
init(1); init(1);
} else { } else {
resumeGame(); resumeGame();
} }
} }
function handlePause() { function handlePause() {
if (gameState == 1 || gameState == 2) { if (gameState == 1 || gameState == 2) {
pause(); pause();
} }
} }
function handleTap(e) { function handleTap(e) {
handleClickTap(e.changedTouches[0].clientX, e.changedTouches[0].clientY); handleClickTap(e.changedTouches[0].clientX, e.changedTouches[0].clientY);
} }
function handleClick(e) { function handleClick(e) {
handleClickTap(e.clientX, e.clientY); handleClickTap(e.clientX, e.clientY);
} }
function handleTapBefore(e) { function handleTapBefore(e) {
var x = e.changedTouches[0].clientX; var x = e.changedTouches[0].clientX;
var y = e.changedTouches[0].clientY; var y = e.changedTouches[0].clientY;
if (x < 120 && y < 50 && $('.helpText').is(':visible')) { if (x < 120 && y < 50 && $('.helpText').is(':visible')) {
showHelp(); showHelp();
return; return;
} }
} }
function handleClickBefore(e) { function handleClickBefore(e) {
var x = e.clientX; var x = e.clientX;
var y = e.clientY; var y = e.clientY;
if (x < 120 && y < 50 && $('.helpText').is(':visible')) { if (x < 120 && y < 50 && $('.helpText').is(':visible')) {
showHelp(); showHelp();
return; return;
} }
} }

View file

@ -1,81 +1,81 @@
function addKeyListeners() { function addKeyListeners() {
keypress.register_combo({ keypress.register_combo({
keys: "left", keys: "left",
on_keydown: function() { on_keydown: function() {
if (MainHex && gameState !== 0) { if (MainHex && gameState !== 0) {
MainHex.rotate(1); MainHex.rotate(1);
} }
} }
}); });
keypress.register_combo({ keypress.register_combo({
keys: "right", keys: "right",
on_keydown: function() { on_keydown: function() {
if (MainHex && gameState !== 0){ if (MainHex && gameState !== 0){
MainHex.rotate(-1); MainHex.rotate(-1);
} }
} }
}); });
keypress.register_combo({ keypress.register_combo({
keys: "down", keys: "down",
on_keydown: function() { on_keydown: function() {
rush=2; rush=2;
}, },
on_release: function() { on_release: function() {
rush=1; rush=1;
} }
}); });
keypress.register_combo({ keypress.register_combo({
keys: "a", keys: "a",
on_keydown: function() { on_keydown: function() {
if (MainHex && gameState !== 0) { if (MainHex && gameState !== 0) {
MainHex.rotate(1); MainHex.rotate(1);
} }
} }
}); });
keypress.register_combo({ keypress.register_combo({
keys: "d", keys: "d",
on_keydown: function() { on_keydown: function() {
if (MainHex && gameState !== 0){ if (MainHex && gameState !== 0){
MainHex.rotate(-1); MainHex.rotate(-1);
} }
} }
}); });
keypress.register_combo({ keypress.register_combo({
keys: "p", keys: "p",
on_keydown: function(){pause();} on_keydown: function(){pause();}
}); });
keypress.register_combo({ keypress.register_combo({
keys: "space", keys: "space",
on_keydown: function(){pause();} on_keydown: function(){pause();}
}); });
keypress.register_combo({ keypress.register_combo({
keys: "q", keys: "q",
on_keydown: function() { on_keydown: function() {
if (devMode) toggleDevTools(); if (devMode) toggleDevTools();
} }
}); });
keypress.register_combo({ keypress.register_combo({
keys: "enter", keys: "enter",
on_keydown: function() { on_keydown: function() {
if (gameState==1 || importing == 1) { if (gameState==1 || importing == 1) {
init(1); init(1);
} }
if (gameState == 2) { if (gameState == 2) {
init(); init();
} }
if (gameState===0) { if (gameState===0) {
resumeGame(); resumeGame();
} }
} }
}); });
$("#pauseBtn").on('touchstart mousedown', function() { $("#pauseBtn").on('touchstart mousedown', function() {
@ -93,134 +93,134 @@ function addKeyListeners() {
$("#colorBlindBtn").on('touchstart mousedown', function() { $("#colorBlindBtn").on('touchstart mousedown', function() {
window.colors = ["#8e44ad", "#f1c40f", "#3498db", "#d35400"]; window.colors = ["#8e44ad", "#f1c40f", "#3498db", "#d35400"];
window.hexColorsToTintedColors = { window.hexColorsToTintedColors = {
"#8e44ad": "rgb(229,152,102)", "#8e44ad": "rgb(229,152,102)",
"#f1c40f": "rgb(246,223,133)", "#f1c40f": "rgb(246,223,133)",
"#3498db": "rgb(151,201,235)", "#3498db": "rgb(151,201,235)",
"#d35400": "rgb(210,180,222)" "#d35400": "rgb(210,180,222)"
}; };
window.rgbToHex = { window.rgbToHex = {
"rgb(142,68,173)": "#8e44ad", "rgb(142,68,173)": "#8e44ad",
"rgb(241,196,15)": "#f1c40f", "rgb(241,196,15)": "#f1c40f",
"rgb(52,152,219)": "#3498db", "rgb(52,152,219)": "#3498db",
"rgb(211,84,0)": "#d35400" "rgb(211,84,0)": "#d35400"
}; };
window.rgbColorsToTintedColors = { window.rgbColorsToTintedColors = {
"rgb(142,68,173)": "rgb(229,152,102)", "rgb(142,68,173)": "rgb(229,152,102)",
"rgb(241,196,15)": "rgb(246,223,133)", "rgb(241,196,15)": "rgb(246,223,133)",
"rgb(52,152,219)": "rgb(151,201,235)", "rgb(52,152,219)": "rgb(151,201,235)",
"rgb(46,204,113)": "rgb(210,180,222)" "rgb(46,204,113)": "rgb(210,180,222)"
}; };
}); });
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
$("#restartBtn").on('touchstart', function() { $("#restartBtn").on('touchstart', function() {
init(1); init(1);
canRestart = false; canRestart = false;
}); });
} }
else { else {
$("#restartBtn").on('mousedown', function() { $("#restartBtn").on('mousedown', function() {
init(1); init(1);
canRestart = false; canRestart = false;
}); });
} }
} }
function inside (point, vs) { function inside (point, vs) {
// ray-casting algorithm based on // ray-casting algorithm based on
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
var x = point[0], y = point[1]; var x = point[0], y = point[1];
var inside = false; var inside = false;
for (var i = 0, j = vs.length - 1; i < vs.length; j = i++) { for (var i = 0, j = vs.length - 1; i < vs.length; j = i++) {
var xi = vs[i][0], yi = vs[i][1]; var xi = vs[i][0], yi = vs[i][1];
var xj = vs[j][0], yj = vs[j][1]; var xj = vs[j][0], yj = vs[j][1];
var intersect = ((yi > y) != (yj > y)) var intersect = ((yi > y) != (yj > y))
&& (x < (xj - xi) * (y - yi) / (yj - yi) + xi); && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
if (intersect) inside = !inside; if (intersect) inside = !inside;
} }
return inside; return inside;
}; };
function handleClickTap(x,y) { function handleClickTap(x,y) {
if (x < 120 && y < 50 && $('.helpText').is(':visible')) { if (x < 120 && y < 50 && $('.helpText').is(':visible')) {
showHelp(); showHelp();
return; return;
} }
var radius = settings.hexWidth ; var radius = settings.hexWidth ;
var halfRadius = radius/2; var halfRadius = radius/2;
var triHeight = radius *(Math.sqrt(3)/2); var triHeight = radius *(Math.sqrt(3)/2);
var Vertexes =[ var Vertexes =[
[radius,0], [radius,0],
[halfRadius,-triHeight], [halfRadius,-triHeight],
[-halfRadius,-triHeight], [-halfRadius,-triHeight],
[-radius,0], [-radius,0],
[-halfRadius,triHeight], [-halfRadius,triHeight],
[halfRadius,triHeight]]; [halfRadius,triHeight]];
Vertexes = Vertexes.map(function(coord){ Vertexes = Vertexes.map(function(coord){
return [coord[0] + trueCanvas.width/2, coord[1] + trueCanvas.height/2]}); return [coord[0] + trueCanvas.width/2, coord[1] + trueCanvas.height/2]});
if (gameState == 1 && inside([x,y],Vertexes)){ if (gameState == 1 && inside([x,y],Vertexes)){
toggleRush(); toggleRush();
return; return;
} }
if (gameState == 2 && canRestart) { if (gameState == 2 && canRestart) {
setTimeout(function() { setTimeout(function() {
if(tweetblock) { if(tweetblock) {
tweetblock = false; tweetblock = false;
return; return;
} }
else{ else{
if (gameState != 1) { if (gameState != 1) {
init(1); init(1);
} }
} }
return; return;
}, 1000); }, 1000);
return; return;
} }
if (!MainHex || gameState === 0 || gameState==-1) { if (!MainHex || gameState === 0 || gameState==-1) {
return; return;
} }
if (x < window.innerWidth/2) { if (x < window.innerWidth/2) {
if (gameState != 1 && gameState != -2 && gameState != -1 ){ if (gameState != 1 && gameState != -2 && gameState != -1 ){
if (importing === 0) { if (importing === 0) {
resumeGame(); resumeGame();
} }
else { else {
init(1); init(1);
} }
} }
MainHex.rotate(1); MainHex.rotate(1);
} }
if (x > window.innerWidth/2) { if (x > window.innerWidth/2) {
if (gameState != 1 && gameState != -2 && gameState != -1) { if (gameState != 1 && gameState != -2 && gameState != -1) {
if (importing === 0) { if (importing === 0) {
resumeGame(); resumeGame();
} }
else { else {
init(1); init(1);
} }
} }
MainHex.rotate(-1); MainHex.rotate(-1);
} }
} }
function toggleRush(){ function toggleRush(){
rush = ((rush)%2)+1; rush = ((rush)%2)+1;
} }
function setRush() { function setRush() {
rush = 2; rush = 2;
} }
function removeRush() { function removeRush() {
rush = 1; rush = 1;
} }

View file

@ -1,341 +1,341 @@
function scaleCanvas() { function scaleCanvas() {
canvas.width = $(window).width(); canvas.width = $(window).width();
canvas.height = $(window).height(); canvas.height = $(window).height();
if (canvas.height > canvas.width) { if (canvas.height > canvas.width) {
settings.scale = (canvas.width / 800) * settings.baseScale; settings.scale = (canvas.width / 800) * settings.baseScale;
} else { } else {
settings.scale = (canvas.height / 800) * settings.baseScale; settings.scale = (canvas.height / 800) * settings.baseScale;
} }
trueCanvas = { trueCanvas = {
width: canvas.width, width: canvas.width,
height: canvas.height height: canvas.height
}; };
if (window.devicePixelRatio) { if (window.devicePixelRatio) {
var cw = $("#canvas").attr('width'); var cw = $("#canvas").attr('width');
var ch = $("#canvas").attr('height'); var ch = $("#canvas").attr('height');
$("#canvas").attr('width', cw * window.devicePixelRatio); $("#canvas").attr('width', cw * window.devicePixelRatio);
$("#canvas").attr('height', ch * window.devicePixelRatio); $("#canvas").attr('height', ch * window.devicePixelRatio);
$("#canvas").css('width', cw); $("#canvas").css('width', cw);
$("#canvas").css('height', ch); $("#canvas").css('height', ch);
trueCanvas = { trueCanvas = {
width: cw, width: cw,
height: ch height: ch
}; };
ctx.scale(window.devicePixelRatio, window.devicePixelRatio); ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
} }
} }
function toggleDevTools() { function toggleDevTools() {
$('#devtools').toggle(); $('#devtools').toggle();
} }
function resumeGame() { function resumeGame() {
gameState = 1; gameState = 1;
hideUIElements(); hideUIElements();
$('#pauseBtn').show(); $('#pauseBtn').show();
$('#restartBtn').hide(); $('#restartBtn').hide();
importing = 0; importing = 0;
startTime = Date.now(); startTime = Date.now();
setTimeout(function() { setTimeout(function() {
if ((gameState == 1 || gameState == 2) && !$('#helpScreen').is(':visible')) { if ((gameState == 1 || gameState == 2) && !$('#helpScreen').is(':visible')) {
$('.helpText').fadeOut(150, "linear"); $('.helpText').fadeOut(150, "linear");
} }
}, 7000); }, 7000);
checkVisualElements(); checkVisualElements();
} }
function checkVisualElements() { function checkVisualElements() {
if (!$('.helpText').is(":visible")) $('.helpText').fadeIn(150, "linear"); if (!$('.helpText').is(":visible")) $('.helpText').fadeIn(150, "linear");
if (!$('#pauseBtn').is(':visible')) $('#pauseBtn').fadeIn(150, "linear"); if (!$('#pauseBtn').is(':visible')) $('#pauseBtn').fadeIn(150, "linear");
$('#fork-ribbon').fadeOut(150); $('#fork-ribbon').fadeOut(150);
if (!$('#restartBtn').is(':visible')) $('#restartBtn').fadeOut(150, "linear"); if (!$('#restartBtn').is(':visible')) $('#restartBtn').fadeOut(150, "linear");
} }
function hideUIElements() { function hideUIElements() {
$('#pauseBtn').hide(); $('#pauseBtn').hide();
$('#restartBtn').hide(); $('#restartBtn').hide();
$('#startBtn').hide(); $('#startBtn').hide();
$("#attributions").hide(); $("#attributions").hide();
$("#bottombar").hide(); $("#bottombar").hide();
} }
function init(b) { function init(b) {
if(settings.ending_block && b == 1){return;} if(settings.ending_block && b == 1){return;}
if (b) { if (b) {
hidebottombar(); hidebottombar();
if ($('#helpScreen').is(":visible")) { if ($('#helpScreen').is(":visible")) {
$('#helpScreen').fadeOut(150, "linear"); $('#helpScreen').fadeOut(150, "linear");
} }
setTimeout(function() { setTimeout(function() {
$('.helpText').fadeOut(150, "linear"); $('.helpText').fadeOut(150, "linear");
infobuttonfading = false; infobuttonfading = false;
}, 7000); }, 7000);
clearSaveState(); clearSaveState();
} }
infobuttonfading = true; infobuttonfading = true;
$("#pauseBtn").html('<img src="./images/btn_pause.svg">'); $("#pauseBtn").html('<img src="./images/btn_pause.svg">');
hideUIElements(); hideUIElements();
var saveState = localStorage.getItem("saveState") || "{}"; var saveState = localStorage.getItem("saveState") || "{}";
saveState = JSONfn.parse(saveState); saveState = JSONfn.parse(saveState);
document.getElementById("canvas").className = ""; document.getElementById("canvas").className = "";
history = {}; history = {};
importedHistory = undefined; importedHistory = undefined;
importing = 0; importing = 0;
isGameOver = 2; isGameOver = 2;
score = saveState.score || 0; score = saveState.score || 0;
prevScore = 0; prevScore = 0;
spawnLane = 0; spawnLane = 0;
op = 0; op = 0;
tweetblock=false; tweetblock=false;
scoreOpacity = 0; scoreOpacity = 0;
gameState = 1; gameState = 1;
$("#restartBtn").hide(); $("#restartBtn").hide();
$("#pauseBtn").show(); $("#pauseBtn").show();
if (saveState.hex !== undefined) gameState = 1; if (saveState.hex !== undefined) gameState = 1;
settings.blockHeight = settings.baseBlockHeight * settings.scale; settings.blockHeight = settings.baseBlockHeight * settings.scale;
settings.hexWidth = settings.baseHexWidth * settings.scale; settings.hexWidth = settings.baseHexWidth * settings.scale;
MainHex = saveState.hex || new Hex(settings.hexWidth); MainHex = saveState.hex || new Hex(settings.hexWidth);
if (saveState.hex) { if (saveState.hex) {
MainHex.playThrough += 1; MainHex.playThrough += 1;
} }
MainHex.sideLength = settings.hexWidth; MainHex.sideLength = settings.hexWidth;
var i; var i;
var block; var block;
if (saveState.blocks) { if (saveState.blocks) {
saveState.blocks.map(function(o) { saveState.blocks.map(function(o) {
if (rgbToHex[o.color]) { if (rgbToHex[o.color]) {
o.color = rgbToHex[o.color]; o.color = rgbToHex[o.color];
} }
}); });
for (i = 0; i < saveState.blocks.length; i++) { for (i = 0; i < saveState.blocks.length; i++) {
block = saveState.blocks[i]; block = saveState.blocks[i];
blocks.push(block); blocks.push(block);
} }
} else { } else {
blocks = []; blocks = [];
} }
gdx = saveState.gdx || 0; gdx = saveState.gdx || 0;
gdy = saveState.gdy || 0; gdy = saveState.gdy || 0;
comboTime = saveState.comboTime || 0; comboTime = saveState.comboTime || 0;
for (i = 0; i < MainHex.blocks.length; i++) { for (i = 0; i < MainHex.blocks.length; i++) {
for (var j = 0; j < MainHex.blocks[i].length; j++) { for (var j = 0; j < MainHex.blocks[i].length; j++) {
MainHex.blocks[i][j].height = settings.blockHeight; MainHex.blocks[i][j].height = settings.blockHeight;
MainHex.blocks[i][j].settled = 0; MainHex.blocks[i][j].settled = 0;
} }
} }
MainHex.blocks.map(function(i) { MainHex.blocks.map(function(i) {
i.map(function(o) { i.map(function(o) {
if (rgbToHex[o.color]) { if (rgbToHex[o.color]) {
o.color = rgbToHex[o.color]; o.color = rgbToHex[o.color];
} }
}); });
}); });
MainHex.y = -100; MainHex.y = -100;
startTime = Date.now(); startTime = Date.now();
waveone = saveState.wavegen || new waveGen(MainHex); waveone = saveState.wavegen || new waveGen(MainHex);
MainHex.texts = []; //clear texts MainHex.texts = []; //clear texts
MainHex.delay = 15; MainHex.delay = 15;
hideText(); hideText();
} }
function addNewBlock(blocklane, color, iter, distFromHex, settled) { //last two are optional parameters function addNewBlock(blocklane, color, iter, distFromHex, settled) { //last two are optional parameters
iter *= settings.speedModifier; iter *= settings.speedModifier;
if (!history[MainHex.ct]) { if (!history[MainHex.ct]) {
history[MainHex.ct] = {}; history[MainHex.ct] = {};
} }
history[MainHex.ct].block = { history[MainHex.ct].block = {
blocklane: blocklane, blocklane: blocklane,
color: color, color: color,
iter: iter iter: iter
}; };
if (distFromHex) { if (distFromHex) {
history[MainHex.ct].distFromHex = distFromHex; history[MainHex.ct].distFromHex = distFromHex;
} }
if (settled) { if (settled) {
blockHist[MainHex.ct].settled = settled; blockHist[MainHex.ct].settled = settled;
} }
blocks.push(new Block(blocklane, color, iter, distFromHex, settled)); blocks.push(new Block(blocklane, color, iter, distFromHex, settled));
} }
function exportHistory() { function exportHistory() {
$('#devtoolsText').html(JSON.stringify(history)); $('#devtoolsText').html(JSON.stringify(history));
toggleDevTools(); toggleDevTools();
} }
function setStartScreen() { function setStartScreen() {
$('#startBtn').show(); $('#startBtn').show();
init(); init();
if (isStateSaved()) { if (isStateSaved()) {
importing = 0; importing = 0;
} else { } else {
importing = 1; importing = 1;
} }
$('#pauseBtn').hide(); $('#pauseBtn').hide();
$('#restartBtn').hide(); $('#restartBtn').hide();
$('#startBtn').show(); $('#startBtn').show();
$('#attributions').show(); $('#attributions').show();
showbottombar(); showbottombar();
gameState = 0; gameState = 0;
requestAnimFrame(animLoop); requestAnimFrame(animLoop);
} }
var spd = 1; var spd = 1;
function animLoop() { function animLoop() {
switch (gameState) { switch (gameState) {
case 1: case 1:
requestAnimFrame(animLoop); requestAnimFrame(animLoop);
render(); render();
var now = Date.now(); var now = Date.now();
var dt = (now - lastTime)/16.666 * rush; var dt = (now - lastTime)/16.666 * rush;
if (spd > 1) { if (spd > 1) {
dt *= spd; dt *= spd;
} }
if(gameState == 1 ){ if(gameState == 1 ){
if(!MainHex.delay) { if(!MainHex.delay) {
update(dt); update(dt);
} }
else{ else{
MainHex.delay--; MainHex.delay--;
} }
} }
lastTime = now; lastTime = now;
if (checkGameOver() && !importing) { if (checkGameOver() && !importing) {
var saveState = localStorage.getItem("saveState") || "{}"; var saveState = localStorage.getItem("saveState") || "{}";
saveState = JSONfn.parse(saveState); saveState = JSONfn.parse(saveState);
gameState = 2; gameState = 2;
setTimeout(function() { setTimeout(function() {
enableRestart(); enableRestart();
}, 150); }, 150);
if ($('#helpScreen').is(':visible')) { if ($('#helpScreen').is(':visible')) {
$('#helpScreen').fadeOut(150, "linear"); $('#helpScreen').fadeOut(150, "linear");
} }
if ($('#pauseBtn').is(':visible')) $('#pauseBtn').fadeOut(150, "linear"); if ($('#pauseBtn').is(':visible')) $('#pauseBtn').fadeOut(150, "linear");
if ($('#restartBtn').is(':visible')) $('#restartBtn').fadeOut(150, "linear"); if ($('#restartBtn').is(':visible')) $('#restartBtn').fadeOut(150, "linear");
if (!$('.helpText').is(':visible')) $('.helpText').fadeIn(150, "linear"); if (!$('.helpText').is(':visible')) $('.helpText').fadeIn(150, "linear");
showbottombar(); showbottombar();
canRestart = 0; canRestart = 0;
clearSaveState(); clearSaveState();
} }
break; break;
case 0: case 0:
requestAnimFrame(animLoop); requestAnimFrame(animLoop);
render(); render();
break; break;
case -1: case -1:
requestAnimFrame(animLoop); requestAnimFrame(animLoop);
render(); render();
break; break;
case 2: case 2:
var now = Date.now(); var now = Date.now();
var dt = (now - lastTime)/16.666 * rush; var dt = (now - lastTime)/16.666 * rush;
requestAnimFrame(animLoop); requestAnimFrame(animLoop);
update(dt); update(dt);
render(); render();
lastTime = now; lastTime = now;
break; break;
case 3: case 3:
requestAnimFrame(animLoop); requestAnimFrame(animLoop);
fadeOutObjectsOnScreen(); fadeOutObjectsOnScreen();
render(); render();
break; break;
case 4: case 4:
setTimeout(function() { setTimeout(function() {
initialize(1); initialize(1);
}, 1); }, 1);
render(); render();
return; return;
default: default:
initialize(); initialize();
setStartScreen(); setStartScreen();
break; break;
} }
if (!(gameState == 1 || gameState == 2)) { if (!(gameState == 1 || gameState == 2)) {
lastTime = Date.now(); lastTime = Date.now();
} }
} }
function enableRestart() { function enableRestart() {
canRestart = 1; canRestart = 1;
} }
function isInfringing(hex) { function isInfringing(hex) {
for (var i = 0; i < hex.sides; i++) { for (var i = 0; i < hex.sides; i++) {
var subTotal = 0; var subTotal = 0;
for (var j = 0; j < hex.blocks[i].length; j++) { for (var j = 0; j < hex.blocks[i].length; j++) {
subTotal += hex.blocks[i][j].deleted; subTotal += hex.blocks[i][j].deleted;
} }
if (hex.blocks[i].length - subTotal > settings.rows) { if (hex.blocks[i].length - subTotal > settings.rows) {
return true; return true;
} }
} }
return false; return false;
} }
function checkGameOver() { function checkGameOver() {
for (var i = 0; i < MainHex.sides; i++) { for (var i = 0; i < MainHex.sides; i++) {
if (isInfringing(MainHex)) { if (isInfringing(MainHex)) {
$.get('http://54.183.184.126/' + String(score)) $.get('http://54.183.184.126/' + String(score))
if (highscores.indexOf(score) == -1) { if (highscores.indexOf(score) == -1) {
highscores.push(score); highscores.push(score);
} }
writeHighScores(); writeHighScores();
gameOverDisplay(); gameOverDisplay();
return true; return true;
} }
} }
return false; return false;
} }
function showHelp() { function showHelp() {
$("#inst_main_body").html("The goal of Hextris is to stop blocks from leaving the inside of the outer gray hexagon<br><br>" + (settings.platform != 'mobile' ? 'Press the right and left arrow keys' : 'tap the left and right sides of the screen') + " to rotate the Hexagon<br><br>Clear blocks and get points by making 3 or more blocks of the same color touch<br><br>Time left before your combo streak disappears is indicated shown by <span style='color:#f1c40f;'>the</span> <span style='color:#e74c3c'>colored</span> <span style='color:#3498db'>lines</span> <span style='color:#2ecc71'>in</span> the outer hexagon<br><br> " + (settings.platform == 'mobile' ? 'Toggle speeding up the game by tapping the inner hexagon' : "Speed up the game 2x by holding the down arrow")); $("#inst_main_body").html("The goal of Hextris is to stop blocks from leaving the inside of the outer gray hexagon<br><br>" + (settings.platform != 'mobile' ? 'Press the right and left arrow keys' : 'tap the left and right sides of the screen') + " to rotate the Hexagon<br><br>Clear blocks and get points by making 3 or more blocks of the same color touch<br><br>Time left before your combo streak disappears is indicated shown by <span style='color:#f1c40f;'>the</span> <span style='color:#e74c3c'>colored</span> <span style='color:#3498db'>lines</span> <span style='color:#2ecc71'>in</span> the outer hexagon<br><br> " + (settings.platform == 'mobile' ? 'Toggle speeding up the game by tapping the inner hexagon' : "Speed up the game 2x by holding the down arrow"));
if (gameState == 1) { if (gameState == 1) {
pause(); pause();
} }
if($("#pauseBtn").children()[0].src.replace(/^.*[\\\/]/, '') == "btn_pause.svg" && gameState != 0 && !infobuttonfading) { if($("#pauseBtn").children()[0].src.replace(/^.*[\\\/]/, '') == "btn_pause.svg" && gameState != 0 && !infobuttonfading) {
return; return;
} }
$("#openSideBar").fadeIn(150,"linear"); $("#openSideBar").fadeIn(150,"linear");
$('#helpScreen').fadeToggle(150, "linear"); $('#helpScreen').fadeToggle(150, "linear");
} }

View file

@ -1,14 +1,14 @@
function rotatePoint(x, y, theta) { function rotatePoint(x, y, theta) {
var thetaRad = theta * (Math.PI / 180); var thetaRad = theta * (Math.PI / 180);
var rotX = Math.cos(thetaRad) * x - Math.sin(thetaRad) * y; var rotX = Math.cos(thetaRad) * x - Math.sin(thetaRad) * y;
var rotY = Math.sin(thetaRad) * x + Math.cos(thetaRad) * y; var rotY = Math.sin(thetaRad) * x + Math.cos(thetaRad) * y;
return { return {
x: rotX, x: rotX,
y: rotY y: rotY
}; };
} }
function randInt(min, max) { function randInt(min, max) {
return Math.floor((Math.random() * max) + min); return Math.floor((Math.random() * max) + min);
} }

View file

@ -37,7 +37,7 @@ function descaleBlock(b) {
} }
function writeHighScores() { function writeHighScores() {
highscores.sort( highscores.sort(
function(a,b){ function(a,b){
a = parseInt(a, 10); a = parseInt(a, 10);
b = parseInt(b, 10); b = parseInt(b, 10);

View file

@ -1,253 +1,253 @@
// t: current time, b: begInnIng value, c: change In value, d: duration // t: current time, b: begInnIng value, c: change In value, d: duration
function easeOutCubic(t, b, c, d) { function easeOutCubic(t, b, c, d) {
return c * ((t = t / d - 1) * t * t + 1) + b; return c * ((t = t / d - 1) * t * t + 1) + b;
} }
function renderText(x, y, fontSize, color, text, font) { function renderText(x, y, fontSize, color, text, font) {
if (text == 'HIGH SCORE') debugger; if (text == 'HIGH SCORE') debugger;
ctx.save(); ctx.save();
if (!font) { if (!font) {
font = 'px/0 Roboto'; font = 'px/0 Roboto';
} }
fontSize *= settings.scale; fontSize *= settings.scale;
ctx.font = fontSize + font; ctx.font = fontSize + font;
ctx.textAlign = 'center'; ctx.textAlign = 'center';
ctx.fillStyle = color; ctx.fillStyle = color;
ctx.fillText(text, x, y + (fontSize / 2) - 9 * settings.scale); ctx.fillText(text, x, y + (fontSize / 2) - 9 * settings.scale);
ctx.restore(); ctx.restore();
} }
function drawScoreboard() { function drawScoreboard() {
if (scoreOpacity < 1) { if (scoreOpacity < 1) {
scoreOpacity += 0.01; scoreOpacity += 0.01;
textOpacity += 0.01; textOpacity += 0.01;
} }
ctx.globalAlpha = textOpacity; ctx.globalAlpha = textOpacity;
var scoreSize = 50; var scoreSize = 50;
var scoreString = String(score); var scoreString = String(score);
if (scoreString.length == 6) { if (scoreString.length == 6) {
scoreSize = 43; scoreSize = 43;
} else if (scoreString.length == 7) { } else if (scoreString.length == 7) {
scoreSize = 35; scoreSize = 35;
} else if (scoreString.length == 8) { } else if (scoreString.length == 8) {
scoreSize = 31; scoreSize = 31;
} else if (scoreString.length == 9) { } else if (scoreString.length == 9) {
scoreSize = 27; scoreSize = 27;
} }
if (rush ==1){ if (rush ==1){
var color = "rgb(236, 240, 241)"; var color = "rgb(236, 240, 241)";
} }
else{ else{
var color = "#e74c3c"; var color = "#e74c3c";
} }
if (gameState === 0) { if (gameState === 0) {
renderText(trueCanvas.width / 2 + gdx + 6 * settings.scale, trueCanvas.height / 2 + gdy, 60, "rgb(236, 240, 241)", String.fromCharCode("0xf04b"), 'px FontAwesome'); renderText(trueCanvas.width / 2 + gdx + 6 * settings.scale, trueCanvas.height / 2 + gdy, 60, "rgb(236, 240, 241)", String.fromCharCode("0xf04b"), 'px FontAwesome');
renderText(trueCanvas.width / 2 + gdx + 6 * settings.scale, trueCanvas.height / 2 + gdy - 170 * settings.scale, 150, "#2c3e50", "Hextris"); renderText(trueCanvas.width / 2 + gdx + 6 * settings.scale, trueCanvas.height / 2 + gdy - 170 * settings.scale, 150, "#2c3e50", "Hextris");
renderText(trueCanvas.width / 2 + gdx + 5 * settings.scale, trueCanvas.height / 2 + gdy + 100 * settings.scale, 30, "rgb(44,62,80)", 'Play!'); renderText(trueCanvas.width / 2 + gdx + 5 * settings.scale, trueCanvas.height / 2 + gdy + 100 * settings.scale, 30, "rgb(44,62,80)", 'Play!');
} else if (gameState != 0 && textOpacity > 0) { } else if (gameState != 0 && textOpacity > 0) {
textOpacity -= 0.05; textOpacity -= 0.05;
renderText(trueCanvas.width / 2 + gdx + 6 * settings.scale, trueCanvas.height / 2 + gdy, 60, "rgb(236, 240, 241)", String.fromCharCode("0xf04b"), 'px FontAwesome'); renderText(trueCanvas.width / 2 + gdx + 6 * settings.scale, trueCanvas.height / 2 + gdy, 60, "rgb(236, 240, 241)", String.fromCharCode("0xf04b"), 'px FontAwesome');
renderText(trueCanvas.width / 2 + gdx + 6 * settings.scale, trueCanvas.height / 2 + gdy - 170 * settings.scale, 150, "#2c3e50", "Hextris"); renderText(trueCanvas.width / 2 + gdx + 6 * settings.scale, trueCanvas.height / 2 + gdy - 170 * settings.scale, 150, "#2c3e50", "Hextris");
renderText(trueCanvas.width / 2 + gdx + 5 * settings.scale, trueCanvas.height / 2 + gdy + 100 * settings.scale, 30, "rgb(44,62,80)", 'Play!'); renderText(trueCanvas.width / 2 + gdx + 5 * settings.scale, trueCanvas.height / 2 + gdy + 100 * settings.scale, 30, "rgb(44,62,80)", 'Play!');
ctx.globalAlpha = scoreOpacity; ctx.globalAlpha = scoreOpacity;
renderText(trueCanvas.width / 2 + gdx, trueCanvas.height / 2 + gdy, scoreSize, color, score); renderText(trueCanvas.width / 2 + gdx, trueCanvas.height / 2 + gdy, scoreSize, color, score);
} else { } else {
ctx.globalAlpha = scoreOpacity; ctx.globalAlpha = scoreOpacity;
renderText(trueCanvas.width / 2 + gdx, trueCanvas.height / 2 + gdy, scoreSize, color, score); renderText(trueCanvas.width / 2 + gdx, trueCanvas.height / 2 + gdy, scoreSize, color, score);
} }
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
} }
function clearGameBoard() { function clearGameBoard() {
drawPolygon(trueCanvas.width / 2, trueCanvas.height / 2, 6, trueCanvas.width / 2, 30, hexagonBackgroundColor, 0, 'rgba(0,0,0,0)'); drawPolygon(trueCanvas.width / 2, trueCanvas.height / 2, 6, trueCanvas.width / 2, 30, hexagonBackgroundColor, 0, 'rgba(0,0,0,0)');
} }
function drawPolygon(x, y, sides, radius, theta, fillColor, lineWidth, lineColor) { function drawPolygon(x, y, sides, radius, theta, fillColor, lineWidth, lineColor) {
ctx.fillStyle = fillColor; ctx.fillStyle = fillColor;
ctx.lineWidth = lineWidth; ctx.lineWidth = lineWidth;
ctx.strokeStyle = lineColor; ctx.strokeStyle = lineColor;
ctx.beginPath(); ctx.beginPath();
var coords = rotatePoint(0, radius, theta); var coords = rotatePoint(0, radius, theta);
ctx.moveTo(coords.x + x, coords.y + y); ctx.moveTo(coords.x + x, coords.y + y);
var oldX = coords.x; var oldX = coords.x;
var oldY = coords.y; var oldY = coords.y;
for (var i = 0; i < sides; i++) { for (var i = 0; i < sides; i++) {
coords = rotatePoint(oldX, oldY, 360 / sides); coords = rotatePoint(oldX, oldY, 360 / sides);
ctx.lineTo(coords.x + x, coords.y + y); ctx.lineTo(coords.x + x, coords.y + y);
oldX = coords.x; oldX = coords.x;
oldY = coords.y; oldY = coords.y;
} }
ctx.closePath(); ctx.closePath();
ctx.fill(); ctx.fill();
ctx.stroke(); ctx.stroke();
ctx.strokeStyle = 'rgba(0,0,0,0)'; ctx.strokeStyle = 'rgba(0,0,0,0)';
} }
function toggleClass(element, active) { function toggleClass(element, active) {
if ($(element).hasClass(active)) { if ($(element).hasClass(active)) {
$(element).removeClass(active); $(element).removeClass(active);
} else { } else {
$(element).addClass(active); $(element).addClass(active);
} }
} }
function showText(text) { function showText(text) {
var messages = { var messages = {
'paused': "<div class='centeredHeader unselectable'>Paused</div><br><div class='unselectable centeredSubHeader'>Press p to resume</div><div style='height:100px;line-height:100px;cursor:pointer;'></div>", 'paused': "<div class='centeredHeader unselectable'>Paused</div><br><div class='unselectable centeredSubHeader'>Press p to resume</div><div style='height:100px;line-height:100px;cursor:pointer;'></div>",
'pausedAndroid': "<div class='centeredHeader unselectable'>Paused</div><br><div class='unselectable centeredSubHeader'>Press <i class='fa fa-play'></i> to resume</div><div style='height:100px;line-height:100px;cursor:pointer;'></div><div class='unselectable centeredSubHeader' style='margin-top:-50px;'><a href = 'market://details?id=com.hextris.hextrisadfree' target='_blank'>Don't like ads? Want to support the developer? Tap for the ad-free version.</a></div>", 'pausedAndroid': "<div class='centeredHeader unselectable'>Paused</div><br><div class='unselectable centeredSubHeader'>Press <i class='fa fa-play'></i> to resume</div><div style='height:100px;line-height:100px;cursor:pointer;'></div><div class='unselectable centeredSubHeader' style='margin-top:-50px;'><a href = 'market://details?id=com.hextris.hextrisadfree' target='_blank'>Don't like ads? Want to support the developer? Tap for the ad-free version.</a></div>",
'start': "<div class='centeredHeader unselectable' style='line-height:80px;'>Press enter to start</div>", 'start': "<div class='centeredHeader unselectable' style='line-height:80px;'>Press enter to start</div>",
'gameover': "<div class='centeredHeader unselectable'> Game Over: " + score + " pts</div><br><div style='font-size:24px;' class='centeredHeader unselectable'> High Scores:</div><table class='tg' style='margin:0px auto'> " 'gameover': "<div class='centeredHeader unselectable'> Game Over: " + score + " pts</div><br><div style='font-size:24px;' class='centeredHeader unselectable'> High Scores:</div><table class='tg' style='margin:0px auto'> "
}; };
if (text == 'paused') { if (text == 'paused') {
if (settings.os == 'android') { if (settings.os == 'android') {
text = 'pausedAndroid'; text = 'pausedAndroid';
} }
} }
if (text == 'gameover') { if (text == 'gameover') {
//Clay('client.share.any', {text: 'Think you can beat my score of '+ score + ' in Super Cool Game?'}) //Clay('client.share.any', {text: 'Think you can beat my score of '+ score + ' in Super Cool Game?'})
var allZ = 1; var allZ = 1;
var i; var i;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if (highscores.length > i) { if (highscores.length > i) {
messages['gameover'] += "<tr> <th class='tg-031e'>" + (i + 1) + ".</th> <th class='tg-031e'>" + highscores[i] + " pts</th> </tr>"; messages['gameover'] += "<tr> <th class='tg-031e'>" + (i + 1) + ".</th> <th class='tg-031e'>" + highscores[i] + " pts</th> </tr>";
} }
} }
var restartText; var restartText;
if (settings.platform == 'mobile') { if (settings.platform == 'mobile') {
restartText = 'Tap anywhere to restart!'; restartText = 'Tap anywhere to restart!';
} else { } else {
restartText = 'Press enter (or click anywhere!) to restart!'; restartText = 'Press enter (or click anywhere!) to restart!';
} }
messages['gameover'] += "</table><br><div class='unselectable centeredSubHeader' id = 'tapToRestart'>" + restartText + "</div>"; messages['gameover'] += "</table><br><div class='unselectable centeredSubHeader' id = 'tapToRestart'>" + restartText + "</div>";
if (allZ) { if (allZ) {
for (i = 0; i < highscores.length; i++) { for (i = 0; i < highscores.length; i++) {
if (highscores[i] !== 0) { if (highscores[i] !== 0) {
allZ = 0; allZ = 0;
} }
} }
} }
} }
messages['gameover'] += "<div class='fltrt' id='tweetStuff'><a class='tweet' href='https://twitter.com/intent/tweet?text=Can you beat my score of "+ score +" points at&button_hashtag=hextris ? http://hextris.github.io/hextris @hextris' data-lang='en' data-related='hextris:hextris' target='_blank'>Share Your Score on Twitter!!!</a></div>" messages['gameover'] += "<div class='fltrt' id='tweetStuff'><a class='tweet' href='https://twitter.com/intent/tweet?text=Can you beat my score of "+ score +" points at&button_hashtag=hextris ? http://hextris.github.io/hextris @hextris' data-lang='en' data-related='hextris:hextris' target='_blank'>Share Your Score on Twitter!!!</a></div>"
$(".overlay").html(messages[text]); $(".overlay").html(messages[text]);
$(".overlay").fadeIn("1000", "swing"); $(".overlay").fadeIn("1000", "swing");
if (text == 'gameover') { if (text == 'gameover') {
if (settings.platform == 'mobile') { if (settings.platform == 'mobile') {
$('.tg').css('margin-top', '6px'); $('.tg').css('margin-top', '6px');
$("#tapToRestart").css('margin-top','-19px') $("#tapToRestart").css('margin-top','-19px')
} }
} }
} }
function setMainMenu() { function setMainMenu() {
gameState = 4; gameState = 4;
canRestart = false; canRestart = false;
setTimeout(function() { setTimeout(function() {
canRestart = 's'; canRestart = 's';
}, 500); }, 500);
$('#restartBtn').hide(); $('#restartBtn').hide();
if ($("#pauseBtn").replace(/^.*[\\\/]/, '') == "btn_pause.svg") { if ($("#pauseBtn").replace(/^.*[\\\/]/, '') == "btn_pause.svg") {
$("#pauseBtn").attr("src","./images/btn_resume.svg"); $("#pauseBtn").attr("src","./images/btn_resume.svg");
} else { } else {
$("#pauseBtn").attr("src","./images/btn_pause.svg"); $("#pauseBtn").attr("src","./images/btn_pause.svg");
} }
} }
function hideText() { function hideText() {
$(".overlay").fadeOut("1000", function() { $(".overlay").fadeOut("1000", function() {
$(".overlay").html(""); $(".overlay").html("");
}) })
} }
function gameOverDisplay() { function gameOverDisplay() {
if( localStorage.getItem("been_mobile") != "true" || true){ if( localStorage.getItem("been_mobile") != "true" || true){
settings.ending_block=true; settings.ending_block=true;
if(settings.os == "android"){ if(settings.os == "android"){
sweetAlert({ sweetAlert({
title: "Hey we'll only bother you once ", title: "Hey we'll only bother you once ",
text:"We do have an Android app!", text:"We do have an Android app!",
showCancelButton: true, showCancelButton: true,
closeOnCancel: true , closeOnCancel: true ,
confirmButtonText: "Take me to it!", confirmButtonText: "Take me to it!",
},function(isConfirm){ },function(isConfirm){
if(isConfirm){ if(isConfirm){
window.location.href="https://play.google.com/store/apps/details?id=com.hextris.hextris" window.location.href="https://play.google.com/store/apps/details?id=com.hextris.hextris"
} }
else{ else{
settings.end_block=false; settings.end_block=false;
} }
}); });
} }
if(settings.os == "ios"){ if(settings.os == "ios"){
sweetAlert({ sweetAlert({
title: "Hey we'll only bother you once ", title: "Hey we'll only bother you once ",
text:"We do have an IOS app!", text:"We do have an IOS app!",
showCancelButton: true, showCancelButton: true,
closeOnCancel: true , closeOnCancel: true ,
confirmButtonText: "Take me to it!", confirmButtonText: "Take me to it!",
},function(isConfirm){ },function(isConfirm){
if(isConfirm){ if(isConfirm){
window.location.href="https://itunes.apple.com/us/app/hextris/id903769553?mt=8"; window.location.href="https://itunes.apple.com/us/app/hextris/id903769553?mt=8";
} }
else{ else{
settings.end_block=false; settings.end_block=false;
} }
}); });
} }
} }
localStorage.setItem("been_mobile", "true"); localStorage.setItem("been_mobile", "true");
$("#attributions").show(); $("#attributions").show();
var c = document.getElementById("canvas"); var c = document.getElementById("canvas");
c.className = "blur"; c.className = "blur";
showText('gameover'); showText('gameover');
showbottombar(); showbottombar();
} }
function pause(o) { function pause(o) {
writeHighScores(); writeHighScores();
var message; var message;
if (o) { if (o) {
message = ''; message = '';
} else { } else {
message = 'paused'; message = 'paused';
} }
var c = document.getElementById("canvas"); var c = document.getElementById("canvas");
if (gameState == -1) { if (gameState == -1) {
$('#restartBtn').fadeOut(150, "linear"); $('#restartBtn').fadeOut(150, "linear");
if ($('#helpScreen').is(':visible')) { if ($('#helpScreen').is(':visible')) {
$('#helpScreen').fadeOut(150, "linear"); $('#helpScreen').fadeOut(150, "linear");
} }
$("#pauseBtn").attr("src", "./images/btn_pause.svg"); $("#pauseBtn").attr("src", "./images/btn_pause.svg");
$('.helpText').fadeOut(200, 'linear'); $('.helpText').fadeOut(200, 'linear');
hideText(); hideText();
hidebottombar(); hidebottombar();
setTimeout(function() { setTimeout(function() {
gameState = prevGameState; gameState = prevGameState;
}, 200) }, 200)
} else if (gameState != -2 && gameState !== 0 && gameState !== 2) { } else if (gameState != -2 && gameState !== 0 && gameState !== 2) {
$('#restartBtn').fadeIn(150, "linear"); $('#restartBtn').fadeIn(150, "linear");
$('.helpText').fadeIn(200, 'linear'); $('.helpText').fadeIn(200, 'linear');
showbottombar(); showbottombar();
if (message == 'paused') { if (message == 'paused') {
showText(message); showText(message);
} }
$("#pauseBtn").attr("src","./images/btn_resume.svg"); $("#pauseBtn").attr("src","./images/btn_resume.svg");
prevGameState = gameState; prevGameState = gameState;
gameState = -1; gameState = -1;
} }
} }

View file

@ -1,201 +1,201 @@
function blockDestroyed() { function blockDestroyed() {
if (waveone.nextGen > 1350) { if (waveone.nextGen > 1350) {
waveone.nextGen -= 30 * settings.creationSpeedModifier; waveone.nextGen -= 30 * settings.creationSpeedModifier;
} else if (waveone.nextGen > 600) { } else if (waveone.nextGen > 600) {
waveone.nextGen -= 8 * settings.creationSpeedModifier; waveone.nextGen -= 8 * settings.creationSpeedModifier;
} else { } else {
waveone.nextGen = 600; waveone.nextGen = 600;
} }
if (waveone.difficulty < 35) { if (waveone.difficulty < 35) {
waveone.difficulty += 0.085 * settings.speedModifier; waveone.difficulty += 0.085 * settings.speedModifier;
} else { } else {
waveone.difficulty = 35; waveone.difficulty = 35;
} }
} }
function waveGen(hex) { function waveGen(hex) {
this.lastGen = 0; this.lastGen = 0;
this.last = 0; this.last = 0;
this.nextGen = 2700; this.nextGen = 2700;
this.start = 0; this.start = 0;
this.colors = colors; this.colors = colors;
this.ct = 0; this.ct = 0;
this.hex = hex; this.hex = hex;
this.difficulty = 1; this.difficulty = 1;
this.dt = 0; this.dt = 0;
this.update = function() { this.update = function() {
this.currentFunction(); this.currentFunction();
this.dt = (settings.platform == 'mobile' ? 14 : 16.6667) * MainHex.ct; this.dt = (settings.platform == 'mobile' ? 14 : 16.6667) * MainHex.ct;
this.computeDifficulty(); this.computeDifficulty();
if ((this.dt - this.lastGen) * settings.creationSpeedModifier > this.nextGen) { if ((this.dt - this.lastGen) * settings.creationSpeedModifier > this.nextGen) {
if (this.nextGen > 600) { if (this.nextGen > 600) {
this.nextGen -= 11 * ((this.nextGen / 1300)) * settings.creationSpeedModifier; this.nextGen -= 11 * ((this.nextGen / 1300)) * settings.creationSpeedModifier;
} }
} }
}; };
this.randomGeneration = function() { this.randomGeneration = function() {
if (this.dt - this.lastGen > this.nextGen) { if (this.dt - this.lastGen > this.nextGen) {
this.ct++; this.ct++;
this.lastGen = this.dt; this.lastGen = this.dt;
var fv = randInt(0, MainHex.sides); var fv = randInt(0, MainHex.sides);
addNewBlock(fv, colors[randInt(0, colors.length)], 1.6 + (this.difficulty / 15) * 3); addNewBlock(fv, colors[randInt(0, colors.length)], 1.6 + (this.difficulty / 15) * 3);
var lim = 5; var lim = 5;
if (this.ct > lim) { if (this.ct > lim) {
var nextPattern = randInt(0, 3 + 21); var nextPattern = randInt(0, 3 + 21);
if (nextPattern > 15) { if (nextPattern > 15) {
this.ct = 0; this.ct = 0;
this.currentFunction = this.doubleGeneration; this.currentFunction = this.doubleGeneration;
} else if (nextPattern > 10) { } else if (nextPattern > 10) {
this.ct = 0; this.ct = 0;
this.currentFunction = this.crosswiseGeneration; this.currentFunction = this.crosswiseGeneration;
} else if (nextPattern > 7) { } else if (nextPattern > 7) {
this.ct = 0; this.ct = 0;
this.currentFunction = this.spiralGeneration; this.currentFunction = this.spiralGeneration;
} else if (nextPattern > 4) { } else if (nextPattern > 4) {
this.ct = 0; this.ct = 0;
this.currentFunction = this.circleGeneration; this.currentFunction = this.circleGeneration;
} else if (nextPattern > 1) { } else if (nextPattern > 1) {
this.ct = 0; this.ct = 0;
this.currentFunction = this.halfCircleGeneration; this.currentFunction = this.halfCircleGeneration;
} }
} }
} }
}; };
this.computeDifficulty = function() { this.computeDifficulty = function() {
if (this.difficulty < 35) { if (this.difficulty < 35) {
var increment; var increment;
if (this.difficulty < 8) { if (this.difficulty < 8) {
increment = (this.dt - this.last) / (5166667) * settings.speedModifier; increment = (this.dt - this.last) / (5166667) * settings.speedModifier;
} else if (this.difficulty < 15) { } else if (this.difficulty < 15) {
increment = (this.dt - this.last) / (72333333) * settings.speedModifier; increment = (this.dt - this.last) / (72333333) * settings.speedModifier;
} else { } else {
increment = (this.dt - this.last) / (90000000) * settings.speedModifier; increment = (this.dt - this.last) / (90000000) * settings.speedModifier;
} }
this.difficulty += increment * (1/2); this.difficulty += increment * (1/2);
} }
}; };
this.circleGeneration = function() { this.circleGeneration = function() {
if (this.dt - this.lastGen > this.nextGen + 500) { if (this.dt - this.lastGen > this.nextGen + 500) {
var numColors = randInt(1, 4); var numColors = randInt(1, 4);
if (numColors == 3) { if (numColors == 3) {
numColors = randInt(1, 4); numColors = randInt(1, 4);
} }
var colorList = []; var colorList = [];
nextLoop: for (var i = 0; i < numColors; i++) { nextLoop: for (var i = 0; i < numColors; i++) {
var q = randInt(0, colors.length); var q = randInt(0, colors.length);
for (var j in colorList) { for (var j in colorList) {
if (colorList[j] == colors[q]) { if (colorList[j] == colors[q]) {
i--; i--;
continue nextLoop; continue nextLoop;
} }
} }
colorList.push(colors[q]); colorList.push(colors[q]);
} }
for (var i = 0; i < MainHex.sides; i++) { for (var i = 0; i < MainHex.sides; i++) {
addNewBlock(i, colorList[i % numColors], 1.5 + (this.difficulty / 15) * 3); addNewBlock(i, colorList[i % numColors], 1.5 + (this.difficulty / 15) * 3);
} }
this.ct += 15; this.ct += 15;
this.lastGen = this.dt; this.lastGen = this.dt;
this.shouldChangePattern(1); this.shouldChangePattern(1);
} }
}; };
this.halfCircleGeneration = function() { this.halfCircleGeneration = function() {
if (this.dt - this.lastGen > (this.nextGen + 500) / 2) { if (this.dt - this.lastGen > (this.nextGen + 500) / 2) {
var numColors = randInt(1, 3); var numColors = randInt(1, 3);
var c = colors[randInt(0, colors.length)]; var c = colors[randInt(0, colors.length)];
var colorList = [c, c, c]; var colorList = [c, c, c];
if (numColors == 2) { if (numColors == 2) {
colorList = [c, colors[randInt(0, colors.length)], c]; colorList = [c, colors[randInt(0, colors.length)], c];
} }
var d = randInt(0, 6); var d = randInt(0, 6);
for (var i = 0; i < 3; i++) { for (var i = 0; i < 3; i++) {
addNewBlock((d + i) % 6, colorList[i], 1.5 + (this.difficulty / 15) * 3); addNewBlock((d + i) % 6, colorList[i], 1.5 + (this.difficulty / 15) * 3);
} }
this.ct += 8; this.ct += 8;
this.lastGen = this.dt; this.lastGen = this.dt;
this.shouldChangePattern(); this.shouldChangePattern();
} }
}; };
this.crosswiseGeneration = function() { this.crosswiseGeneration = function() {
if (this.dt - this.lastGen > this.nextGen) { if (this.dt - this.lastGen > this.nextGen) {
var ri = randInt(0, colors.length); var ri = randInt(0, colors.length);
var i = randInt(0, colors.length); var i = randInt(0, colors.length);
addNewBlock(i, colors[ri], 0.6 + (this.difficulty / 15) * 3); addNewBlock(i, colors[ri], 0.6 + (this.difficulty / 15) * 3);
addNewBlock((i + 3) % MainHex.sides, colors[ri], 0.6 + (this.difficulty / 15) * 3); addNewBlock((i + 3) % MainHex.sides, colors[ri], 0.6 + (this.difficulty / 15) * 3);
this.ct += 1.5; this.ct += 1.5;
this.lastGen = this.dt; this.lastGen = this.dt;
this.shouldChangePattern(); this.shouldChangePattern();
} }
}; };
this.spiralGeneration = function() { this.spiralGeneration = function() {
var dir = randInt(0, 2); var dir = randInt(0, 2);
if (this.dt - this.lastGen > this.nextGen * (2 / 3)) { if (this.dt - this.lastGen > this.nextGen * (2 / 3)) {
if (dir) { if (dir) {
addNewBlock(5 - (this.ct % MainHex.sides), colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * (3 / 2)); addNewBlock(5 - (this.ct % MainHex.sides), colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * (3 / 2));
} else { } else {
addNewBlock(this.ct % MainHex.sides, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * (3 / 2)); addNewBlock(this.ct % MainHex.sides, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * (3 / 2));
} }
this.ct += 1; this.ct += 1;
this.lastGen = this.dt; this.lastGen = this.dt;
this.shouldChangePattern(); this.shouldChangePattern();
} }
}; };
this.doubleGeneration = function() { this.doubleGeneration = function() {
if (this.dt - this.lastGen > this.nextGen) { if (this.dt - this.lastGen > this.nextGen) {
var i = randInt(0, colors.length); var i = randInt(0, colors.length);
addNewBlock(i, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * 3); addNewBlock(i, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * 3);
addNewBlock((i + 1) % MainHex.sides, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * 3); addNewBlock((i + 1) % MainHex.sides, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * 3);
this.ct += 2; this.ct += 2;
this.lastGen = this.dt; this.lastGen = this.dt;
this.shouldChangePattern(); this.shouldChangePattern();
} }
}; };
this.setRandom = function() { this.setRandom = function() {
this.ct = 0; this.ct = 0;
this.currentFunction = this.randomGeneration; this.currentFunction = this.randomGeneration;
}; };
this.shouldChangePattern = function(x) { this.shouldChangePattern = function(x) {
if (x) { if (x) {
var q = randInt(0, 4); var q = randInt(0, 4);
this.ct = 0; this.ct = 0;
switch (q) { switch (q) {
case 0: case 0:
this.currentFunction = this.doubleGeneration; this.currentFunction = this.doubleGeneration;
break; break;
case 1: case 1:
this.currentFunction = this.spiralGeneration; this.currentFunction = this.spiralGeneration;
break; break;
case 2: case 2:
this.currentFunction = this.crosswiseGeneration; this.currentFunction = this.crosswiseGeneration;
break; break;
} }
} else if (this.ct > 8) { } else if (this.ct > 8) {
if (randInt(0, 2) === 0) { if (randInt(0, 2) === 0) {
this.setRandom(); this.setRandom();
return 1; return 1;
} }
} }
return 0; return 0;
}; };
// rest of generation functions // rest of generation functions
this.currentFunction = this.randomGeneration; this.currentFunction = this.randomGeneration;
} }

View file

@ -85,36 +85,36 @@
} }
@-moz-keyframes spin { @-moz-keyframes spin {
0% { 0% {
-moz-transform: rotate(0deg); -moz-transform: rotate(0deg);
} }
100% { 100% {
-moz-transform: rotate(359deg); -moz-transform: rotate(359deg);
} }
} }
@-webkit-keyframes spin { @-webkit-keyframes spin {
0% { 0% {
-webkit-transform: rotate(0deg); -webkit-transform: rotate(0deg);
} }
100% { 100% {
-webkit-transform: rotate(359deg); -webkit-transform: rotate(359deg);
} }
} }
@-o-keyframes spin { @-o-keyframes spin {
0% { 0% {
-o-transform: rotate(0deg); -o-transform: rotate(0deg);
} }
100% { 100% {
-o-transform: rotate(359deg); -o-transform: rotate(359deg);
} }
} }
@keyframes spin { @keyframes spin {
0% { 0% {
-webkit-transform: rotate(0deg); -webkit-transform: rotate(0deg);
transform: rotate(0deg); transform: rotate(0deg);
} }
100% { 100% {
-webkit-transform: rotate(359deg); -webkit-transform: rotate(359deg);
transform: rotate(359deg); transform: rotate(359deg);
} }
} }
.fa-rotate-90 { .fa-rotate-90 {