Merge branch 'clay-improvements' of github.com:Hextris/hextris into clay-improvements
32
LICENSE.md
|
@ -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
|
||||
where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
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
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
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.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type 'show c' for details.
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type 'show c' for details.
|
||||
|
||||
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;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?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">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Back button</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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>
|
||||
<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>
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Back button</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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>
|
||||
<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>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -1,19 +1,19 @@
|
|||
<?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">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Facebook</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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="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>
|
||||
<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>
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Facebook</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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="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>
|
||||
<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>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.6 KiB |
|
@ -1,17 +1,17 @@
|
|||
<?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">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Help</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="Help-+-Social" sketch:type="MSLayerGroup" transform="translate(48.000000, 525.000000)">
|
||||
<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>
|
||||
<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>
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Help</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="Help-+-Social" sketch:type="MSLayerGroup" transform="translate(48.000000, 525.000000)">
|
||||
<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>
|
||||
<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>
|
||||
</svg>
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.1 KiB |
|
@ -1,15 +1,15 @@
|
|||
<?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">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Pause button</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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>
|
||||
<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>
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Pause button</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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>
|
||||
<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>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -1,15 +1,15 @@
|
|||
<?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">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Restart button</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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>
|
||||
<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>
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Restart button</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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>
|
||||
<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>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.5 KiB |
|
@ -1,15 +1,15 @@
|
|||
<?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">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Resume button</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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>
|
||||
<path d="M26,24 L26,52 L49,38 L26,24 Z" id="Play-icon" fill="#2C3E50" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Resume button</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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>
|
||||
<path d="M26,24 L26,52 L49,38 L26,24 Z" id="Play-icon" fill="#2C3E50" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -1,17 +1,17 @@
|
|||
<?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">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Share button</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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>
|
||||
<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>
|
||||
</text>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Share button</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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>
|
||||
<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>
|
||||
</text>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -1,19 +1,19 @@
|
|||
<?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">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Twitter</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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="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>
|
||||
<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>
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Twitter</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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="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>
|
||||
<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>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.5 KiB |
|
@ -1,14 +1,14 @@
|
|||
<?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">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Arrows icon</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Arrows icon</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<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="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>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -73,8 +73,8 @@
|
|||
</div>
|
||||
<div class="faded overlay"></div>
|
||||
<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>
|
||||
By <a href="http://loganengstrom.com/" target="_blank">Logan Engstrom</a> & <a href='garrettdreyfus.github.io' target="_blank">Garrett Finucane</a>
|
||||
<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>
|
||||
</div>
|
||||
<div id='startBtn' ></div>
|
||||
<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>
|
||||
<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>
|
||||
|
|
|
@ -5,7 +5,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
|
|||
//the lane which the block was shot from
|
||||
this.fallingLane = fallingLane;
|
||||
|
||||
this.checked=0;
|
||||
this.checked=0;
|
||||
//the angle at which the block falls
|
||||
this.angle = 90 - (30 + 60 * fallingLane);
|
||||
//for calculating the rotation of blocks attached to the center hex
|
||||
|
@ -92,7 +92,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
|
|||
else {
|
||||
this.angle += this.angularVelocity;
|
||||
}
|
||||
|
||||
|
||||
this.width = 2 * this.distFromHex / Math.sqrt(3);
|
||||
this.widthWide = 2 * (this.distFromHex + this.height) / Math.sqrt(3);
|
||||
//this.widthWide = this.width + this.height + 3;
|
||||
|
|
14
js_v9/Hex.js
|
@ -17,10 +17,10 @@ function Hex(sideLength) {
|
|||
this.y = trueCanvas.height / 2;
|
||||
this.ct = 0;
|
||||
this.lastCombo = this.ct - settings.comboTime;
|
||||
this.lastColorScored = "#000";
|
||||
this.lastColorScored = "#000";
|
||||
this.comboTime = 1;
|
||||
this.texts = [];
|
||||
this.lastRotate = Date.now();
|
||||
this.lastRotate = Date.now();
|
||||
for (var i = 0; i < this.sides; i++) {
|
||||
this.blocks.push([]);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ function Hex(sideLength) {
|
|||
block.distFromHex = MainHex.sideLength / 2 * Math.sqrt(3) + block.height * this.blocks[lane].length;
|
||||
this.blocks[lane].push(block);
|
||||
block.attachedLane = lane;
|
||||
block.checked = 1;
|
||||
block.checked = 1;
|
||||
};
|
||||
|
||||
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) {
|
||||
block.distFromHex = (this.sideLength / 2) * Math.sqrt(3);
|
||||
block.settled = 1;
|
||||
block.checked = 1;
|
||||
block.checked = 1;
|
||||
} else {
|
||||
block.settled = 0;
|
||||
block.iter = 1.5 + (waveone.difficulty/15) * 3;
|
||||
|
@ -105,7 +105,7 @@ function Hex(sideLength) {
|
|||
};
|
||||
|
||||
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;
|
||||
this.position += steps;
|
||||
if (!history[this.ct]) {
|
||||
|
@ -131,7 +131,7 @@ function Hex(sideLength) {
|
|||
});
|
||||
|
||||
this.targetAngle = this.targetAngle - steps * 60;
|
||||
this.lastRotate = Date.now();
|
||||
this.lastRotate = Date.now();
|
||||
};
|
||||
|
||||
this.draw = function() {
|
||||
|
@ -166,5 +166,5 @@ function Hex(sideLength) {
|
|||
}
|
||||
|
||||
function arrayToColor(arr){
|
||||
return 'rgb(' + arr[0]+ ','+arr[1]+','+arr[2]+')';
|
||||
return 'rgb(' + arr[0]+ ','+arr[1]+','+arr[2]+')';
|
||||
}
|
||||
|
|
|
@ -79,6 +79,6 @@ function consolidateBlocks(hex,side,index){
|
|||
}
|
||||
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.lastColorScored = deletedBlocks[0].color;
|
||||
hex.lastColorScored = deletedBlocks[0].color;
|
||||
score += adder;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
function drawTimer() {
|
||||
if(gameState==1){
|
||||
var leftVertexes = [];
|
||||
var rightVertexes = [];
|
||||
var leftVertexes = [];
|
||||
var rightVertexes = [];
|
||||
if(MainHex.ct - MainHex.lastCombo < settings.comboTime){
|
||||
for(var i=0;i<6;i++){
|
||||
var done = (MainHex.ct -MainHex.lastCombo);
|
||||
if(done<(settings.comboTime)*(5-i)*(1/6)){
|
||||
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{
|
||||
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(leftVertexes.length !== 0) drawSide(leftVertexes);
|
||||
if(rightVertexes.length !== 0) drawSide(rightVertexes);
|
||||
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 endX = trueCanvas.width/2 + Vertexes[endVertex][0];
|
||||
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){
|
||||
if (gameState === 0) {
|
||||
|
@ -58,12 +58,12 @@ function drawSide(vertexes){
|
|||
ctx.strokeStyle = MainHex.lastColorScored;
|
||||
}
|
||||
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]);
|
||||
for(var i=1;i<vertexes.length;i++){
|
||||
ctx.lineTo(vertexes[i][1][0],vertexes[i][1][1]);
|
||||
ctx.moveTo(vertexes[i][1][0],vertexes[i][1][1]);
|
||||
}
|
||||
for(var i=1;i<vertexes.length;i++){
|
||||
ctx.lineTo(vertexes[i][1][0],vertexes[i][1][1]);
|
||||
ctx.moveTo(vertexes[i][1][0],vertexes[i][1][1]);
|
||||
}
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
ctx.stroke();
|
||||
|
|
|
@ -1,325 +1,325 @@
|
|||
$(document).ready(function() {
|
||||
initialize();
|
||||
$('#bottombar').hide();
|
||||
initialize();
|
||||
$('#bottombar').hide();
|
||||
});
|
||||
|
||||
function showbottombar() {
|
||||
var isOffline = 'onLine' in navigator && !navigator.onLine;
|
||||
if (isOffline) {
|
||||
setTimeout(showbottombar, 1000);
|
||||
} else {
|
||||
window.iframeHasLoaded = true;
|
||||
if (gameState != 1) {
|
||||
$('#bottombar').fadeIn(150, 'linear');
|
||||
}
|
||||
}
|
||||
var isOffline = 'onLine' in navigator && !navigator.onLine;
|
||||
if (isOffline) {
|
||||
setTimeout(showbottombar, 1000);
|
||||
} else {
|
||||
window.iframeHasLoaded = true;
|
||||
if (gameState != 1) {
|
||||
$('#bottombar').fadeIn(150, 'linear');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hidebottombar() {
|
||||
$('#bottombar').fadeOut(150, 'linear');
|
||||
$('#bottombar').fadeOut(150, 'linear');
|
||||
}
|
||||
|
||||
function initialize(a) {
|
||||
window.rush = 1;
|
||||
window.lastTime = Date.now();
|
||||
window.iframHasLoaded = false;
|
||||
window.colors = ["#e74c3c", "#f1c40f", "#3498db", "#2ecc71"];
|
||||
window.hexColorsToTintedColors = {
|
||||
"#e74c3c": "rgb(241,163,155)",
|
||||
"#f1c40f": "rgb(246,223,133)",
|
||||
"#3498db": "rgb(151,201,235)",
|
||||
"#2ecc71": "rgb(150,227,183)"
|
||||
};
|
||||
window.rush = 1;
|
||||
window.lastTime = Date.now();
|
||||
window.iframHasLoaded = false;
|
||||
window.colors = ["#e74c3c", "#f1c40f", "#3498db", "#2ecc71"];
|
||||
window.hexColorsToTintedColors = {
|
||||
"#e74c3c": "rgb(241,163,155)",
|
||||
"#f1c40f": "rgb(246,223,133)",
|
||||
"#3498db": "rgb(151,201,235)",
|
||||
"#2ecc71": "rgb(150,227,183)"
|
||||
};
|
||||
|
||||
window.rgbToHex = {
|
||||
"rgb(231,76,60)": "#e74c3c",
|
||||
"rgb(241,196,15)": "#f1c40f",
|
||||
"rgb(52,152,219)": "#3498db",
|
||||
"rgb(46,204,113)": "#2ecc71"
|
||||
};
|
||||
window.rgbToHex = {
|
||||
"rgb(231,76,60)": "#e74c3c",
|
||||
"rgb(241,196,15)": "#f1c40f",
|
||||
"rgb(52,152,219)": "#3498db",
|
||||
"rgb(46,204,113)": "#2ecc71"
|
||||
};
|
||||
|
||||
window.rgbColorsToTintedColors = {
|
||||
"rgb(231,76,60)": "rgb(241,163,155)",
|
||||
"rgb(241,196,15)": "rgb(246,223,133)",
|
||||
"rgb(52,152,219)": "rgb(151,201,235)",
|
||||
"rgb(46,204,113)": "rgb(150,227,183)"
|
||||
};
|
||||
window.rgbColorsToTintedColors = {
|
||||
"rgb(231,76,60)": "rgb(241,163,155)",
|
||||
"rgb(241,196,15)": "rgb(246,223,133)",
|
||||
"rgb(52,152,219)": "rgb(151,201,235)",
|
||||
"rgb(46,204,113)": "rgb(150,227,183)"
|
||||
};
|
||||
|
||||
window.hexagonBackgroundColor = 'rgb(236, 240, 241)';
|
||||
window.hexagonBackgroundColorClear = 'rgba(236, 240, 241, 0.5)';
|
||||
window.centerBlue = 'rgb(44,62,80)';
|
||||
window.angularVelocityConst = 4;
|
||||
window.scoreOpacity = 0;
|
||||
window.textOpacity = 0;
|
||||
window.prevGameState = undefined;
|
||||
window.hexagonBackgroundColor = 'rgb(236, 240, 241)';
|
||||
window.hexagonBackgroundColorClear = 'rgba(236, 240, 241, 0.5)';
|
||||
window.centerBlue = 'rgb(44,62,80)';
|
||||
window.angularVelocityConst = 4;
|
||||
window.scoreOpacity = 0;
|
||||
window.textOpacity = 0;
|
||||
window.prevGameState = undefined;
|
||||
|
||||
//render.js
|
||||
window.op = 0;
|
||||
window.saveState = localStorage.getItem("saveState") || "{}";
|
||||
if (saveState !== "{}") {
|
||||
op = 1;
|
||||
}
|
||||
//render.js
|
||||
window.op = 0;
|
||||
window.saveState = localStorage.getItem("saveState") || "{}";
|
||||
if (saveState !== "{}") {
|
||||
op = 1;
|
||||
}
|
||||
|
||||
//input.js
|
||||
//all of main.js
|
||||
//input.js
|
||||
//all of main.js
|
||||
|
||||
//main.js
|
||||
window.textShown = false;
|
||||
//main.js
|
||||
window.textShown = false;
|
||||
|
||||
window.requestAnimFrame = (function() {
|
||||
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
|
||||
window.setTimeout(callback, 1000 / framerate);
|
||||
};
|
||||
})();
|
||||
window.requestAnimFrame = (function() {
|
||||
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
|
||||
window.setTimeout(callback, 1000 / framerate);
|
||||
};
|
||||
})();
|
||||
|
||||
$('#clickToExit').bind('click', toggleDevTools);
|
||||
window.settings;
|
||||
$('#clickToExit').bind('click', toggleDevTools);
|
||||
window.settings;
|
||||
|
||||
if (/Mobile|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
||||
settings = {
|
||||
os: "other",
|
||||
platform: "mobile",
|
||||
startDist: 227,
|
||||
creationDt: 60,
|
||||
baseScale: 1.4,
|
||||
scale: 1,
|
||||
prevScale: 1,
|
||||
baseHexWidth: 87,
|
||||
hexWidth: 87,
|
||||
baseBlockHeight: 20,
|
||||
blockHeight: 20,
|
||||
rows: 7,
|
||||
speedModifier: 0.73,
|
||||
creationSpeedModifier: 0.73,
|
||||
comboTime: 240
|
||||
};
|
||||
} else {
|
||||
settings = {
|
||||
os: "other",
|
||||
platform: "nonmobile",
|
||||
baseScale: 1,
|
||||
startDist: 340,
|
||||
creationDt: 9,
|
||||
scale: 1,
|
||||
prevScale: 1,
|
||||
hexWidth: 65,
|
||||
baseHexWidth: 87,
|
||||
baseBlockHeight: 20,
|
||||
blockHeight: 15,
|
||||
rows: 8,
|
||||
speedModifier: 0.65,
|
||||
creationSpeedModifier: 0.65,
|
||||
comboTime: 240
|
||||
};
|
||||
if (/Mobile|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
||||
settings = {
|
||||
os: "other",
|
||||
platform: "mobile",
|
||||
startDist: 227,
|
||||
creationDt: 60,
|
||||
baseScale: 1.4,
|
||||
scale: 1,
|
||||
prevScale: 1,
|
||||
baseHexWidth: 87,
|
||||
hexWidth: 87,
|
||||
baseBlockHeight: 20,
|
||||
blockHeight: 20,
|
||||
rows: 7,
|
||||
speedModifier: 0.73,
|
||||
creationSpeedModifier: 0.73,
|
||||
comboTime: 240
|
||||
};
|
||||
} else {
|
||||
settings = {
|
||||
os: "other",
|
||||
platform: "nonmobile",
|
||||
baseScale: 1,
|
||||
startDist: 340,
|
||||
creationDt: 9,
|
||||
scale: 1,
|
||||
prevScale: 1,
|
||||
hexWidth: 65,
|
||||
baseHexWidth: 87,
|
||||
baseBlockHeight: 20,
|
||||
blockHeight: 15,
|
||||
rows: 8,
|
||||
speedModifier: 0.65,
|
||||
creationSpeedModifier: 0.65,
|
||||
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"));
|
||||
}
|
||||
if(/Android/i.test(navigator.userAgent)) {
|
||||
settings.os = "android";
|
||||
}
|
||||
$("#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)) {
|
||||
settings.os = "android";
|
||||
}
|
||||
|
||||
if(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i)){
|
||||
settings.os="ios";
|
||||
}
|
||||
if(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i)){
|
||||
settings.os="ios";
|
||||
}
|
||||
|
||||
window.canvas = document.getElementById('canvas');
|
||||
window.ctx = canvas.getContext('2d');
|
||||
window.trueCanvas = {
|
||||
width: canvas.width,
|
||||
height: canvas.height
|
||||
};
|
||||
scaleCanvas();
|
||||
window.canvas = document.getElementById('canvas');
|
||||
window.ctx = canvas.getContext('2d');
|
||||
window.trueCanvas = {
|
||||
width: canvas.width,
|
||||
height: canvas.height
|
||||
};
|
||||
scaleCanvas();
|
||||
|
||||
window.framerate = 60;
|
||||
window.history = {};
|
||||
window.score = 0;
|
||||
window.isGameOver = 3;
|
||||
window.scoreAdditionCoeff = 1;
|
||||
window.prevScore = 0;
|
||||
window.numHighScores = 3;
|
||||
window.framerate = 60;
|
||||
window.history = {};
|
||||
window.score = 0;
|
||||
window.isGameOver = 3;
|
||||
window.scoreAdditionCoeff = 1;
|
||||
window.prevScore = 0;
|
||||
window.numHighScores = 3;
|
||||
|
||||
highscores = [];
|
||||
if (localStorage.getItem('highscores')) {
|
||||
try {
|
||||
highscores = JSON.parse(localStorage.getItem('highscores'));
|
||||
} catch (e) {
|
||||
highscores = [];
|
||||
}
|
||||
}
|
||||
highscores = [];
|
||||
if (localStorage.getItem('highscores')) {
|
||||
try {
|
||||
highscores = JSON.parse(localStorage.getItem('highscores'));
|
||||
} catch (e) {
|
||||
highscores = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
window.blocks = [];
|
||||
window.MainHex;
|
||||
window.blocks = [];
|
||||
window.MainHex;
|
||||
|
||||
window.gdx = 0;
|
||||
window.gdy = 0;
|
||||
window.gdx = 0;
|
||||
window.gdy = 0;
|
||||
|
||||
window.devMode = 0;
|
||||
window.lastGen = undefined;
|
||||
window.prevTimeScored = undefined;
|
||||
window.nextGen = undefined;
|
||||
window.spawnLane = 0;
|
||||
window.importing = 0;
|
||||
window.importedHistory = undefined;
|
||||
window.startTime = undefined;
|
||||
window.devMode = 0;
|
||||
window.lastGen = undefined;
|
||||
window.prevTimeScored = undefined;
|
||||
window.nextGen = undefined;
|
||||
window.spawnLane = 0;
|
||||
window.importing = 0;
|
||||
window.importedHistory = undefined;
|
||||
window.startTime = undefined;
|
||||
|
||||
window.gameState;
|
||||
setStartScreen();
|
||||
window.gameState;
|
||||
setStartScreen();
|
||||
|
||||
if (a != 1) {
|
||||
window.canRestart = 1;
|
||||
window.onblur = function(e) {
|
||||
if (gameState == 1) {
|
||||
pause();
|
||||
}
|
||||
};
|
||||
if (a != 1) {
|
||||
window.canRestart = 1;
|
||||
window.onblur = function(e) {
|
||||
if (gameState == 1) {
|
||||
pause();
|
||||
}
|
||||
};
|
||||
|
||||
$('#startBtn').off();
|
||||
$('#startBtn').off();
|
||||
|
||||
if (settings.platform == 'mobile') {
|
||||
$('#startBtn').on('touchstart', startBtnHandler);
|
||||
} else {
|
||||
$('#startBtn').on('mousedown', startBtnHandler);
|
||||
}
|
||||
if (settings.platform == 'mobile') {
|
||||
$('#startBtn').on('touchstart', startBtnHandler);
|
||||
} else {
|
||||
$('#startBtn').on('mousedown', startBtnHandler);
|
||||
}
|
||||
|
||||
document.addEventListener('touchmove', function(e) {
|
||||
e.preventDefault();
|
||||
}, false);
|
||||
$(window).resize(scaleCanvas);
|
||||
$(window).unload(function() {
|
||||
document.addEventListener('touchmove', function(e) {
|
||||
e.preventDefault();
|
||||
}, false);
|
||||
$(window).resize(scaleCanvas);
|
||||
$(window).unload(function() {
|
||||
|
||||
if (gameState == 1 || gameState == -1 || gameState === 0) localStorage.setItem("saveState", exportSaveState());
|
||||
else localStorage.setItem("saveState", "{}");
|
||||
});
|
||||
if (gameState == 1 || gameState == -1 || gameState === 0) localStorage.setItem("saveState", exportSaveState());
|
||||
else localStorage.setItem("saveState", "{}");
|
||||
});
|
||||
|
||||
addKeyListeners();
|
||||
(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-1', 'teamsnowman.github.io');
|
||||
ga('send', 'pageview');
|
||||
addKeyListeners();
|
||||
(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-1', 'teamsnowman.github.io');
|
||||
ga('send', 'pageview');
|
||||
|
||||
document.addEventListener("pause", handlePause, false);
|
||||
document.addEventListener("backbutton", handlePause, false);
|
||||
document.addEventListener("menubutton", handlePause, false); //menu button on android
|
||||
document.addEventListener("pause", handlePause, false);
|
||||
document.addEventListener("backbutton", handlePause, false);
|
||||
document.addEventListener("menubutton", handlePause, false); //menu button on android
|
||||
|
||||
setTimeout(function() {
|
||||
if (settings.platform == "mobile") {
|
||||
try {
|
||||
document.body.removeEventListener('touchstart', handleTapBefore, false);
|
||||
} catch (e) {
|
||||
setTimeout(function() {
|
||||
if (settings.platform == "mobile") {
|
||||
try {
|
||||
document.body.removeEventListener('touchstart', handleTapBefore, false);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
document.body.removeEventListener('touchstart', handleTap, false);
|
||||
} catch (e) {
|
||||
try {
|
||||
document.body.removeEventListener('touchstart', handleTap, false);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
document.body.addEventListener('touchstart', handleTapBefore, false);
|
||||
} else {
|
||||
try {
|
||||
document.body.removeEventListener('mousedown', handleClickBefore, false);
|
||||
} catch (e) {
|
||||
document.body.addEventListener('touchstart', handleTapBefore, false);
|
||||
} else {
|
||||
try {
|
||||
document.body.removeEventListener('mousedown', handleClickBefore, false);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
document.body.removeEventListener('mousedown', handleClick, false);
|
||||
} catch (e) {
|
||||
try {
|
||||
document.body.removeEventListener('mousedown', handleClick, false);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
document.body.addEventListener('mousedown', handleClickBefore, false);
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
document.body.addEventListener('mousedown', handleClickBefore, false);
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
function startBtnHandler() {
|
||||
setTimeout(function() {
|
||||
if (settings.platform == "mobile") {
|
||||
try {
|
||||
document.body.removeEventListener('touchstart', handleTapBefore, false);
|
||||
} catch (e) {
|
||||
setTimeout(function() {
|
||||
if (settings.platform == "mobile") {
|
||||
try {
|
||||
document.body.removeEventListener('touchstart', handleTapBefore, false);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
document.body.removeEventListener('touchstart', handleTap, false);
|
||||
} catch (e) {
|
||||
try {
|
||||
document.body.removeEventListener('touchstart', handleTap, false);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
document.body.addEventListener('touchstart', handleTap, false);
|
||||
} else {
|
||||
try {
|
||||
document.body.removeEventListener('mousedown', handleClickBefore, false);
|
||||
} catch (e) {
|
||||
document.body.addEventListener('touchstart', handleTap, false);
|
||||
} else {
|
||||
try {
|
||||
document.body.removeEventListener('mousedown', handleClickBefore, false);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
document.body.removeEventListener('mousedown', handleClick, false);
|
||||
} catch (e) {
|
||||
try {
|
||||
document.body.removeEventListener('mousedown', handleClick, false);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
document.body.addEventListener('mousedown', handleClick, false);
|
||||
}
|
||||
}, 5);
|
||||
document.body.addEventListener('mousedown', handleClick, false);
|
||||
}
|
||||
}, 5);
|
||||
|
||||
if (!canRestart) return false;
|
||||
if (!canRestart) return false;
|
||||
|
||||
if ($('#helpScreen').is(':visible')) {
|
||||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
if ($('#helpScreen').is(':visible')) {
|
||||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
|
||||
if (importing == 1) {
|
||||
init(1);
|
||||
} else {
|
||||
resumeGame();
|
||||
}
|
||||
if (importing == 1) {
|
||||
init(1);
|
||||
} else {
|
||||
resumeGame();
|
||||
}
|
||||
}
|
||||
|
||||
function handlePause() {
|
||||
if (gameState == 1 || gameState == 2) {
|
||||
pause();
|
||||
}
|
||||
if (gameState == 1 || gameState == 2) {
|
||||
pause();
|
||||
}
|
||||
}
|
||||
|
||||
function handleTap(e) {
|
||||
handleClickTap(e.changedTouches[0].clientX, e.changedTouches[0].clientY);
|
||||
handleClickTap(e.changedTouches[0].clientX, e.changedTouches[0].clientY);
|
||||
}
|
||||
|
||||
function handleClick(e) {
|
||||
handleClickTap(e.clientX, e.clientY);
|
||||
handleClickTap(e.clientX, e.clientY);
|
||||
}
|
||||
|
||||
function handleTapBefore(e) {
|
||||
var x = e.changedTouches[0].clientX;
|
||||
var y = e.changedTouches[0].clientY;
|
||||
var x = e.changedTouches[0].clientX;
|
||||
var y = e.changedTouches[0].clientY;
|
||||
|
||||
if (x < 120 && y < 50 && $('.helpText').is(':visible')) {
|
||||
showHelp();
|
||||
return;
|
||||
}
|
||||
if (x < 120 && y < 50 && $('.helpText').is(':visible')) {
|
||||
showHelp();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function handleClickBefore(e) {
|
||||
var x = e.clientX;
|
||||
var y = e.clientY;
|
||||
var x = e.clientX;
|
||||
var y = e.clientY;
|
||||
|
||||
if (x < 120 && y < 50 && $('.helpText').is(':visible')) {
|
||||
showHelp();
|
||||
return;
|
||||
}
|
||||
if (x < 120 && y < 50 && $('.helpText').is(':visible')) {
|
||||
showHelp();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
354
js_v9/input.js
|
@ -1,81 +1,81 @@
|
|||
function addKeyListeners() {
|
||||
keypress.register_combo({
|
||||
keys: "left",
|
||||
on_keydown: function() {
|
||||
if (MainHex && gameState !== 0) {
|
||||
MainHex.rotate(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
keypress.register_combo({
|
||||
keys: "left",
|
||||
on_keydown: function() {
|
||||
if (MainHex && gameState !== 0) {
|
||||
MainHex.rotate(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
keypress.register_combo({
|
||||
keys: "right",
|
||||
on_keydown: function() {
|
||||
if (MainHex && gameState !== 0){
|
||||
MainHex.rotate(-1);
|
||||
}
|
||||
}
|
||||
});
|
||||
keypress.register_combo({
|
||||
keys: "down",
|
||||
on_keydown: function() {
|
||||
rush=2;
|
||||
},
|
||||
on_release: function() {
|
||||
rush=1;
|
||||
}
|
||||
keypress.register_combo({
|
||||
keys: "right",
|
||||
on_keydown: function() {
|
||||
if (MainHex && gameState !== 0){
|
||||
MainHex.rotate(-1);
|
||||
}
|
||||
}
|
||||
});
|
||||
keypress.register_combo({
|
||||
keys: "down",
|
||||
on_keydown: function() {
|
||||
rush=2;
|
||||
},
|
||||
on_release: function() {
|
||||
rush=1;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
keypress.register_combo({
|
||||
keys: "a",
|
||||
on_keydown: function() {
|
||||
if (MainHex && gameState !== 0) {
|
||||
MainHex.rotate(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
keypress.register_combo({
|
||||
keys: "a",
|
||||
on_keydown: function() {
|
||||
if (MainHex && gameState !== 0) {
|
||||
MainHex.rotate(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
keypress.register_combo({
|
||||
keys: "d",
|
||||
on_keydown: function() {
|
||||
if (MainHex && gameState !== 0){
|
||||
MainHex.rotate(-1);
|
||||
}
|
||||
}
|
||||
});
|
||||
keypress.register_combo({
|
||||
keys: "d",
|
||||
on_keydown: function() {
|
||||
if (MainHex && gameState !== 0){
|
||||
MainHex.rotate(-1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
keypress.register_combo({
|
||||
keys: "p",
|
||||
on_keydown: function(){pause();}
|
||||
});
|
||||
keypress.register_combo({
|
||||
keys: "p",
|
||||
on_keydown: function(){pause();}
|
||||
});
|
||||
|
||||
keypress.register_combo({
|
||||
keys: "space",
|
||||
on_keydown: function(){pause();}
|
||||
});
|
||||
keypress.register_combo({
|
||||
keys: "space",
|
||||
on_keydown: function(){pause();}
|
||||
});
|
||||
|
||||
keypress.register_combo({
|
||||
keys: "q",
|
||||
on_keydown: function() {
|
||||
if (devMode) toggleDevTools();
|
||||
}
|
||||
});
|
||||
keypress.register_combo({
|
||||
keys: "q",
|
||||
on_keydown: function() {
|
||||
if (devMode) toggleDevTools();
|
||||
}
|
||||
});
|
||||
|
||||
keypress.register_combo({
|
||||
keys: "enter",
|
||||
on_keydown: function() {
|
||||
if (gameState==1 || importing == 1) {
|
||||
init(1);
|
||||
}
|
||||
if (gameState == 2) {
|
||||
init();
|
||||
}
|
||||
if (gameState===0) {
|
||||
resumeGame();
|
||||
}
|
||||
}
|
||||
});
|
||||
keypress.register_combo({
|
||||
keys: "enter",
|
||||
on_keydown: function() {
|
||||
if (gameState==1 || importing == 1) {
|
||||
init(1);
|
||||
}
|
||||
if (gameState == 2) {
|
||||
init();
|
||||
}
|
||||
if (gameState===0) {
|
||||
resumeGame();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#pauseBtn").on('touchstart mousedown', function() {
|
||||
|
||||
|
@ -93,134 +93,134 @@ function addKeyListeners() {
|
|||
$("#colorBlindBtn").on('touchstart mousedown', function() {
|
||||
window.colors = ["#8e44ad", "#f1c40f", "#3498db", "#d35400"];
|
||||
|
||||
window.hexColorsToTintedColors = {
|
||||
"#8e44ad": "rgb(229,152,102)",
|
||||
"#f1c40f": "rgb(246,223,133)",
|
||||
"#3498db": "rgb(151,201,235)",
|
||||
"#d35400": "rgb(210,180,222)"
|
||||
};
|
||||
window.hexColorsToTintedColors = {
|
||||
"#8e44ad": "rgb(229,152,102)",
|
||||
"#f1c40f": "rgb(246,223,133)",
|
||||
"#3498db": "rgb(151,201,235)",
|
||||
"#d35400": "rgb(210,180,222)"
|
||||
};
|
||||
|
||||
window.rgbToHex = {
|
||||
"rgb(142,68,173)": "#8e44ad",
|
||||
"rgb(241,196,15)": "#f1c40f",
|
||||
"rgb(52,152,219)": "#3498db",
|
||||
"rgb(211,84,0)": "#d35400"
|
||||
};
|
||||
window.rgbToHex = {
|
||||
"rgb(142,68,173)": "#8e44ad",
|
||||
"rgb(241,196,15)": "#f1c40f",
|
||||
"rgb(52,152,219)": "#3498db",
|
||||
"rgb(211,84,0)": "#d35400"
|
||||
};
|
||||
|
||||
window.rgbColorsToTintedColors = {
|
||||
"rgb(142,68,173)": "rgb(229,152,102)",
|
||||
"rgb(241,196,15)": "rgb(246,223,133)",
|
||||
"rgb(52,152,219)": "rgb(151,201,235)",
|
||||
"rgb(46,204,113)": "rgb(210,180,222)"
|
||||
window.rgbColorsToTintedColors = {
|
||||
"rgb(142,68,173)": "rgb(229,152,102)",
|
||||
"rgb(241,196,15)": "rgb(246,223,133)",
|
||||
"rgb(52,152,219)": "rgb(151,201,235)",
|
||||
"rgb(46,204,113)": "rgb(210,180,222)"
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
||||
$("#restartBtn").on('touchstart', function() {
|
||||
init(1);
|
||||
canRestart = false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#restartBtn").on('mousedown', function() {
|
||||
init(1);
|
||||
canRestart = false;
|
||||
});
|
||||
}
|
||||
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
||||
$("#restartBtn").on('touchstart', function() {
|
||||
init(1);
|
||||
canRestart = false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#restartBtn").on('mousedown', function() {
|
||||
init(1);
|
||||
canRestart = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
function inside (point, vs) {
|
||||
// ray-casting algorithm based on
|
||||
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
|
||||
|
||||
var x = point[0], y = point[1];
|
||||
|
||||
var inside = false;
|
||||
for (var i = 0, j = vs.length - 1; i < vs.length; j = i++) {
|
||||
var xi = vs[i][0], yi = vs[i][1];
|
||||
var xj = vs[j][0], yj = vs[j][1];
|
||||
|
||||
var intersect = ((yi > y) != (yj > y))
|
||||
&& (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
|
||||
if (intersect) inside = !inside;
|
||||
}
|
||||
|
||||
return inside;
|
||||
// ray-casting algorithm based on
|
||||
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
|
||||
|
||||
var x = point[0], y = point[1];
|
||||
|
||||
var inside = false;
|
||||
for (var i = 0, j = vs.length - 1; i < vs.length; j = i++) {
|
||||
var xi = vs[i][0], yi = vs[i][1];
|
||||
var xj = vs[j][0], yj = vs[j][1];
|
||||
|
||||
var intersect = ((yi > y) != (yj > y))
|
||||
&& (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
|
||||
if (intersect) inside = !inside;
|
||||
}
|
||||
|
||||
return inside;
|
||||
};
|
||||
|
||||
function handleClickTap(x,y) {
|
||||
if (x < 120 && y < 50 && $('.helpText').is(':visible')) {
|
||||
showHelp();
|
||||
return;
|
||||
}
|
||||
var radius = settings.hexWidth ;
|
||||
var halfRadius = radius/2;
|
||||
var triHeight = radius *(Math.sqrt(3)/2);
|
||||
var Vertexes =[
|
||||
[radius,0],
|
||||
[halfRadius,-triHeight],
|
||||
[-halfRadius,-triHeight],
|
||||
[-radius,0],
|
||||
[-halfRadius,triHeight],
|
||||
[halfRadius,triHeight]];
|
||||
Vertexes = Vertexes.map(function(coord){
|
||||
return [coord[0] + trueCanvas.width/2, coord[1] + trueCanvas.height/2]});
|
||||
if (gameState == 1 && inside([x,y],Vertexes)){
|
||||
toggleRush();
|
||||
return;
|
||||
}
|
||||
if (gameState == 2 && canRestart) {
|
||||
setTimeout(function() {
|
||||
if(tweetblock) {
|
||||
tweetblock = false;
|
||||
return;
|
||||
}
|
||||
else{
|
||||
if (gameState != 1) {
|
||||
init(1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}, 1000);
|
||||
return;
|
||||
}
|
||||
if (x < 120 && y < 50 && $('.helpText').is(':visible')) {
|
||||
showHelp();
|
||||
return;
|
||||
}
|
||||
var radius = settings.hexWidth ;
|
||||
var halfRadius = radius/2;
|
||||
var triHeight = radius *(Math.sqrt(3)/2);
|
||||
var Vertexes =[
|
||||
[radius,0],
|
||||
[halfRadius,-triHeight],
|
||||
[-halfRadius,-triHeight],
|
||||
[-radius,0],
|
||||
[-halfRadius,triHeight],
|
||||
[halfRadius,triHeight]];
|
||||
Vertexes = Vertexes.map(function(coord){
|
||||
return [coord[0] + trueCanvas.width/2, coord[1] + trueCanvas.height/2]});
|
||||
if (gameState == 1 && inside([x,y],Vertexes)){
|
||||
toggleRush();
|
||||
return;
|
||||
}
|
||||
if (gameState == 2 && canRestart) {
|
||||
setTimeout(function() {
|
||||
if(tweetblock) {
|
||||
tweetblock = false;
|
||||
return;
|
||||
}
|
||||
else{
|
||||
if (gameState != 1) {
|
||||
init(1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}, 1000);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MainHex || gameState === 0 || gameState==-1) {
|
||||
return;
|
||||
}
|
||||
if (!MainHex || gameState === 0 || gameState==-1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (x < window.innerWidth/2) {
|
||||
if (gameState != 1 && gameState != -2 && gameState != -1 ){
|
||||
if (importing === 0) {
|
||||
resumeGame();
|
||||
}
|
||||
else {
|
||||
init(1);
|
||||
}
|
||||
}
|
||||
if (x < window.innerWidth/2) {
|
||||
if (gameState != 1 && gameState != -2 && gameState != -1 ){
|
||||
if (importing === 0) {
|
||||
resumeGame();
|
||||
}
|
||||
else {
|
||||
init(1);
|
||||
}
|
||||
}
|
||||
|
||||
MainHex.rotate(1);
|
||||
}
|
||||
if (x > window.innerWidth/2) {
|
||||
if (gameState != 1 && gameState != -2 && gameState != -1) {
|
||||
if (importing === 0) {
|
||||
resumeGame();
|
||||
}
|
||||
else {
|
||||
init(1);
|
||||
}
|
||||
}
|
||||
MainHex.rotate(-1);
|
||||
}
|
||||
MainHex.rotate(1);
|
||||
}
|
||||
if (x > window.innerWidth/2) {
|
||||
if (gameState != 1 && gameState != -2 && gameState != -1) {
|
||||
if (importing === 0) {
|
||||
resumeGame();
|
||||
}
|
||||
else {
|
||||
init(1);
|
||||
}
|
||||
}
|
||||
MainHex.rotate(-1);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleRush(){
|
||||
rush = ((rush)%2)+1;
|
||||
rush = ((rush)%2)+1;
|
||||
}
|
||||
function setRush() {
|
||||
rush = 2;
|
||||
rush = 2;
|
||||
}
|
||||
|
||||
function removeRush() {
|
||||
rush = 1;
|
||||
rush = 1;
|
||||
}
|
||||
|
|
514
js_v9/main.js
|
@ -1,341 +1,341 @@
|
|||
function scaleCanvas() {
|
||||
canvas.width = $(window).width();
|
||||
canvas.height = $(window).height();
|
||||
canvas.width = $(window).width();
|
||||
canvas.height = $(window).height();
|
||||
|
||||
if (canvas.height > canvas.width) {
|
||||
settings.scale = (canvas.width / 800) * settings.baseScale;
|
||||
} else {
|
||||
settings.scale = (canvas.height / 800) * settings.baseScale;
|
||||
}
|
||||
if (canvas.height > canvas.width) {
|
||||
settings.scale = (canvas.width / 800) * settings.baseScale;
|
||||
} else {
|
||||
settings.scale = (canvas.height / 800) * settings.baseScale;
|
||||
}
|
||||
|
||||
trueCanvas = {
|
||||
width: canvas.width,
|
||||
height: canvas.height
|
||||
};
|
||||
trueCanvas = {
|
||||
width: canvas.width,
|
||||
height: canvas.height
|
||||
};
|
||||
|
||||
if (window.devicePixelRatio) {
|
||||
var cw = $("#canvas").attr('width');
|
||||
var ch = $("#canvas").attr('height');
|
||||
if (window.devicePixelRatio) {
|
||||
var cw = $("#canvas").attr('width');
|
||||
var ch = $("#canvas").attr('height');
|
||||
|
||||
$("#canvas").attr('width', cw * window.devicePixelRatio);
|
||||
$("#canvas").attr('height', ch * window.devicePixelRatio);
|
||||
$("#canvas").css('width', cw);
|
||||
$("#canvas").css('height', ch);
|
||||
$("#canvas").attr('width', cw * window.devicePixelRatio);
|
||||
$("#canvas").attr('height', ch * window.devicePixelRatio);
|
||||
$("#canvas").css('width', cw);
|
||||
$("#canvas").css('height', ch);
|
||||
|
||||
trueCanvas = {
|
||||
width: cw,
|
||||
height: ch
|
||||
};
|
||||
trueCanvas = {
|
||||
width: cw,
|
||||
height: ch
|
||||
};
|
||||
|
||||
ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
|
||||
}
|
||||
ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleDevTools() {
|
||||
$('#devtools').toggle();
|
||||
$('#devtools').toggle();
|
||||
}
|
||||
|
||||
function resumeGame() {
|
||||
gameState = 1;
|
||||
hideUIElements();
|
||||
$('#pauseBtn').show();
|
||||
$('#restartBtn').hide();
|
||||
importing = 0;
|
||||
startTime = Date.now();
|
||||
setTimeout(function() {
|
||||
if ((gameState == 1 || gameState == 2) && !$('#helpScreen').is(':visible')) {
|
||||
$('.helpText').fadeOut(150, "linear");
|
||||
}
|
||||
}, 7000);
|
||||
gameState = 1;
|
||||
hideUIElements();
|
||||
$('#pauseBtn').show();
|
||||
$('#restartBtn').hide();
|
||||
importing = 0;
|
||||
startTime = Date.now();
|
||||
setTimeout(function() {
|
||||
if ((gameState == 1 || gameState == 2) && !$('#helpScreen').is(':visible')) {
|
||||
$('.helpText').fadeOut(150, "linear");
|
||||
}
|
||||
}, 7000);
|
||||
|
||||
checkVisualElements();
|
||||
checkVisualElements();
|
||||
}
|
||||
|
||||
function checkVisualElements() {
|
||||
if (!$('.helpText').is(":visible")) $('.helpText').fadeIn(150, "linear");
|
||||
if (!$('#pauseBtn').is(':visible')) $('#pauseBtn').fadeIn(150, "linear");
|
||||
$('#fork-ribbon').fadeOut(150);
|
||||
if (!$('#restartBtn').is(':visible')) $('#restartBtn').fadeOut(150, "linear");
|
||||
if (!$('.helpText').is(":visible")) $('.helpText').fadeIn(150, "linear");
|
||||
if (!$('#pauseBtn').is(':visible')) $('#pauseBtn').fadeIn(150, "linear");
|
||||
$('#fork-ribbon').fadeOut(150);
|
||||
if (!$('#restartBtn').is(':visible')) $('#restartBtn').fadeOut(150, "linear");
|
||||
}
|
||||
|
||||
function hideUIElements() {
|
||||
$('#pauseBtn').hide();
|
||||
$('#restartBtn').hide();
|
||||
$('#startBtn').hide();
|
||||
$("#attributions").hide();
|
||||
$("#bottombar").hide();
|
||||
$('#pauseBtn').hide();
|
||||
$('#restartBtn').hide();
|
||||
$('#startBtn').hide();
|
||||
$("#attributions").hide();
|
||||
$("#bottombar").hide();
|
||||
}
|
||||
|
||||
function init(b) {
|
||||
if(settings.ending_block && b == 1){return;}
|
||||
if (b) {
|
||||
hidebottombar();
|
||||
if(settings.ending_block && b == 1){return;}
|
||||
if (b) {
|
||||
hidebottombar();
|
||||
|
||||
|
||||
if ($('#helpScreen').is(":visible")) {
|
||||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
if ($('#helpScreen').is(":visible")) {
|
||||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
$('.helpText').fadeOut(150, "linear");
|
||||
infobuttonfading = false;
|
||||
}, 7000);
|
||||
clearSaveState();
|
||||
}
|
||||
setTimeout(function() {
|
||||
$('.helpText').fadeOut(150, "linear");
|
||||
infobuttonfading = false;
|
||||
}, 7000);
|
||||
clearSaveState();
|
||||
}
|
||||
|
||||
infobuttonfading = true;
|
||||
$("#pauseBtn").html('<img src="./images/btn_pause.svg">');
|
||||
hideUIElements();
|
||||
var saveState = localStorage.getItem("saveState") || "{}";
|
||||
saveState = JSONfn.parse(saveState);
|
||||
document.getElementById("canvas").className = "";
|
||||
history = {};
|
||||
importedHistory = undefined;
|
||||
importing = 0;
|
||||
isGameOver = 2;
|
||||
score = saveState.score || 0;
|
||||
prevScore = 0;
|
||||
spawnLane = 0;
|
||||
op = 0;
|
||||
tweetblock=false;
|
||||
scoreOpacity = 0;
|
||||
gameState = 1;
|
||||
$("#restartBtn").hide();
|
||||
$("#pauseBtn").show();
|
||||
if (saveState.hex !== undefined) gameState = 1;
|
||||
infobuttonfading = true;
|
||||
$("#pauseBtn").html('<img src="./images/btn_pause.svg">');
|
||||
hideUIElements();
|
||||
var saveState = localStorage.getItem("saveState") || "{}";
|
||||
saveState = JSONfn.parse(saveState);
|
||||
document.getElementById("canvas").className = "";
|
||||
history = {};
|
||||
importedHistory = undefined;
|
||||
importing = 0;
|
||||
isGameOver = 2;
|
||||
score = saveState.score || 0;
|
||||
prevScore = 0;
|
||||
spawnLane = 0;
|
||||
op = 0;
|
||||
tweetblock=false;
|
||||
scoreOpacity = 0;
|
||||
gameState = 1;
|
||||
$("#restartBtn").hide();
|
||||
$("#pauseBtn").show();
|
||||
if (saveState.hex !== undefined) gameState = 1;
|
||||
|
||||
settings.blockHeight = settings.baseBlockHeight * settings.scale;
|
||||
settings.hexWidth = settings.baseHexWidth * settings.scale;
|
||||
MainHex = saveState.hex || new Hex(settings.hexWidth);
|
||||
if (saveState.hex) {
|
||||
MainHex.playThrough += 1;
|
||||
}
|
||||
MainHex.sideLength = settings.hexWidth;
|
||||
settings.blockHeight = settings.baseBlockHeight * settings.scale;
|
||||
settings.hexWidth = settings.baseHexWidth * settings.scale;
|
||||
MainHex = saveState.hex || new Hex(settings.hexWidth);
|
||||
if (saveState.hex) {
|
||||
MainHex.playThrough += 1;
|
||||
}
|
||||
MainHex.sideLength = settings.hexWidth;
|
||||
|
||||
var i;
|
||||
var block;
|
||||
if (saveState.blocks) {
|
||||
saveState.blocks.map(function(o) {
|
||||
if (rgbToHex[o.color]) {
|
||||
o.color = rgbToHex[o.color];
|
||||
}
|
||||
});
|
||||
var i;
|
||||
var block;
|
||||
if (saveState.blocks) {
|
||||
saveState.blocks.map(function(o) {
|
||||
if (rgbToHex[o.color]) {
|
||||
o.color = rgbToHex[o.color];
|
||||
}
|
||||
});
|
||||
|
||||
for (i = 0; i < saveState.blocks.length; i++) {
|
||||
block = saveState.blocks[i];
|
||||
blocks.push(block);
|
||||
}
|
||||
} else {
|
||||
blocks = [];
|
||||
}
|
||||
for (i = 0; i < saveState.blocks.length; i++) {
|
||||
block = saveState.blocks[i];
|
||||
blocks.push(block);
|
||||
}
|
||||
} else {
|
||||
blocks = [];
|
||||
}
|
||||
|
||||
gdx = saveState.gdx || 0;
|
||||
gdy = saveState.gdy || 0;
|
||||
comboTime = saveState.comboTime || 0;
|
||||
gdx = saveState.gdx || 0;
|
||||
gdy = saveState.gdy || 0;
|
||||
comboTime = saveState.comboTime || 0;
|
||||
|
||||
for (i = 0; i < MainHex.blocks.length; i++) {
|
||||
for (var j = 0; j < MainHex.blocks[i].length; j++) {
|
||||
MainHex.blocks[i][j].height = settings.blockHeight;
|
||||
MainHex.blocks[i][j].settled = 0;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < MainHex.blocks.length; i++) {
|
||||
for (var j = 0; j < MainHex.blocks[i].length; j++) {
|
||||
MainHex.blocks[i][j].height = settings.blockHeight;
|
||||
MainHex.blocks[i][j].settled = 0;
|
||||
}
|
||||
}
|
||||
|
||||
MainHex.blocks.map(function(i) {
|
||||
i.map(function(o) {
|
||||
if (rgbToHex[o.color]) {
|
||||
o.color = rgbToHex[o.color];
|
||||
}
|
||||
});
|
||||
});
|
||||
MainHex.blocks.map(function(i) {
|
||||
i.map(function(o) {
|
||||
if (rgbToHex[o.color]) {
|
||||
o.color = rgbToHex[o.color];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
MainHex.y = -100;
|
||||
MainHex.y = -100;
|
||||
|
||||
startTime = Date.now();
|
||||
waveone = saveState.wavegen || new waveGen(MainHex);
|
||||
startTime = Date.now();
|
||||
waveone = saveState.wavegen || new waveGen(MainHex);
|
||||
|
||||
MainHex.texts = []; //clear texts
|
||||
MainHex.delay = 15;
|
||||
hideText();
|
||||
MainHex.texts = []; //clear texts
|
||||
MainHex.delay = 15;
|
||||
hideText();
|
||||
}
|
||||
|
||||
function addNewBlock(blocklane, color, iter, distFromHex, settled) { //last two are optional parameters
|
||||
iter *= settings.speedModifier;
|
||||
if (!history[MainHex.ct]) {
|
||||
history[MainHex.ct] = {};
|
||||
}
|
||||
iter *= settings.speedModifier;
|
||||
if (!history[MainHex.ct]) {
|
||||
history[MainHex.ct] = {};
|
||||
}
|
||||
|
||||
history[MainHex.ct].block = {
|
||||
blocklane: blocklane,
|
||||
color: color,
|
||||
iter: iter
|
||||
};
|
||||
history[MainHex.ct].block = {
|
||||
blocklane: blocklane,
|
||||
color: color,
|
||||
iter: iter
|
||||
};
|
||||
|
||||
if (distFromHex) {
|
||||
history[MainHex.ct].distFromHex = distFromHex;
|
||||
}
|
||||
if (settled) {
|
||||
blockHist[MainHex.ct].settled = settled;
|
||||
}
|
||||
blocks.push(new Block(blocklane, color, iter, distFromHex, settled));
|
||||
if (distFromHex) {
|
||||
history[MainHex.ct].distFromHex = distFromHex;
|
||||
}
|
||||
if (settled) {
|
||||
blockHist[MainHex.ct].settled = settled;
|
||||
}
|
||||
blocks.push(new Block(blocklane, color, iter, distFromHex, settled));
|
||||
}
|
||||
|
||||
function exportHistory() {
|
||||
$('#devtoolsText').html(JSON.stringify(history));
|
||||
toggleDevTools();
|
||||
$('#devtoolsText').html(JSON.stringify(history));
|
||||
toggleDevTools();
|
||||
}
|
||||
|
||||
function setStartScreen() {
|
||||
$('#startBtn').show();
|
||||
init();
|
||||
if (isStateSaved()) {
|
||||
importing = 0;
|
||||
} else {
|
||||
importing = 1;
|
||||
}
|
||||
$('#startBtn').show();
|
||||
init();
|
||||
if (isStateSaved()) {
|
||||
importing = 0;
|
||||
} else {
|
||||
importing = 1;
|
||||
}
|
||||
|
||||
$('#pauseBtn').hide();
|
||||
$('#restartBtn').hide();
|
||||
$('#startBtn').show();
|
||||
$('#attributions').show();
|
||||
showbottombar();
|
||||
$('#pauseBtn').hide();
|
||||
$('#restartBtn').hide();
|
||||
$('#startBtn').show();
|
||||
$('#attributions').show();
|
||||
showbottombar();
|
||||
|
||||
gameState = 0;
|
||||
requestAnimFrame(animLoop);
|
||||
gameState = 0;
|
||||
requestAnimFrame(animLoop);
|
||||
}
|
||||
|
||||
var spd = 1;
|
||||
|
||||
function animLoop() {
|
||||
switch (gameState) {
|
||||
case 1:
|
||||
requestAnimFrame(animLoop);
|
||||
render();
|
||||
var now = Date.now();
|
||||
var dt = (now - lastTime)/16.666 * rush;
|
||||
if (spd > 1) {
|
||||
dt *= spd;
|
||||
}
|
||||
switch (gameState) {
|
||||
case 1:
|
||||
requestAnimFrame(animLoop);
|
||||
render();
|
||||
var now = Date.now();
|
||||
var dt = (now - lastTime)/16.666 * rush;
|
||||
if (spd > 1) {
|
||||
dt *= spd;
|
||||
}
|
||||
|
||||
if(gameState == 1 ){
|
||||
if(!MainHex.delay) {
|
||||
update(dt);
|
||||
}
|
||||
else{
|
||||
MainHex.delay--;
|
||||
}
|
||||
}
|
||||
if(gameState == 1 ){
|
||||
if(!MainHex.delay) {
|
||||
update(dt);
|
||||
}
|
||||
else{
|
||||
MainHex.delay--;
|
||||
}
|
||||
}
|
||||
|
||||
lastTime = now;
|
||||
lastTime = now;
|
||||
|
||||
if (checkGameOver() && !importing) {
|
||||
var saveState = localStorage.getItem("saveState") || "{}";
|
||||
saveState = JSONfn.parse(saveState);
|
||||
gameState = 2;
|
||||
if (checkGameOver() && !importing) {
|
||||
var saveState = localStorage.getItem("saveState") || "{}";
|
||||
saveState = JSONfn.parse(saveState);
|
||||
gameState = 2;
|
||||
|
||||
setTimeout(function() {
|
||||
enableRestart();
|
||||
}, 150);
|
||||
setTimeout(function() {
|
||||
enableRestart();
|
||||
}, 150);
|
||||
|
||||
if ($('#helpScreen').is(':visible')) {
|
||||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
if ($('#helpScreen').is(':visible')) {
|
||||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
|
||||
if ($('#pauseBtn').is(':visible')) $('#pauseBtn').fadeOut(150, "linear");
|
||||
if ($('#restartBtn').is(':visible')) $('#restartBtn').fadeOut(150, "linear");
|
||||
if (!$('.helpText').is(':visible')) $('.helpText').fadeIn(150, "linear");
|
||||
if ($('#pauseBtn').is(':visible')) $('#pauseBtn').fadeOut(150, "linear");
|
||||
if ($('#restartBtn').is(':visible')) $('#restartBtn').fadeOut(150, "linear");
|
||||
if (!$('.helpText').is(':visible')) $('.helpText').fadeIn(150, "linear");
|
||||
|
||||
showbottombar();
|
||||
canRestart = 0;
|
||||
clearSaveState();
|
||||
}
|
||||
break;
|
||||
showbottombar();
|
||||
canRestart = 0;
|
||||
clearSaveState();
|
||||
}
|
||||
break;
|
||||
|
||||
case 0:
|
||||
requestAnimFrame(animLoop);
|
||||
render();
|
||||
break;
|
||||
case 0:
|
||||
requestAnimFrame(animLoop);
|
||||
render();
|
||||
break;
|
||||
|
||||
case -1:
|
||||
requestAnimFrame(animLoop);
|
||||
render();
|
||||
break;
|
||||
case -1:
|
||||
requestAnimFrame(animLoop);
|
||||
render();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
var now = Date.now();
|
||||
var dt = (now - lastTime)/16.666 * rush;
|
||||
requestAnimFrame(animLoop);
|
||||
update(dt);
|
||||
render();
|
||||
lastTime = now;
|
||||
break;
|
||||
case 2:
|
||||
var now = Date.now();
|
||||
var dt = (now - lastTime)/16.666 * rush;
|
||||
requestAnimFrame(animLoop);
|
||||
update(dt);
|
||||
render();
|
||||
lastTime = now;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
requestAnimFrame(animLoop);
|
||||
fadeOutObjectsOnScreen();
|
||||
render();
|
||||
break;
|
||||
case 3:
|
||||
requestAnimFrame(animLoop);
|
||||
fadeOutObjectsOnScreen();
|
||||
render();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
setTimeout(function() {
|
||||
initialize(1);
|
||||
}, 1);
|
||||
render();
|
||||
return;
|
||||
case 4:
|
||||
setTimeout(function() {
|
||||
initialize(1);
|
||||
}, 1);
|
||||
render();
|
||||
return;
|
||||
|
||||
default:
|
||||
initialize();
|
||||
setStartScreen();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
initialize();
|
||||
setStartScreen();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(gameState == 1 || gameState == 2)) {
|
||||
lastTime = Date.now();
|
||||
}
|
||||
if (!(gameState == 1 || gameState == 2)) {
|
||||
lastTime = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
function enableRestart() {
|
||||
canRestart = 1;
|
||||
canRestart = 1;
|
||||
}
|
||||
|
||||
function isInfringing(hex) {
|
||||
for (var i = 0; i < hex.sides; i++) {
|
||||
var subTotal = 0;
|
||||
for (var j = 0; j < hex.blocks[i].length; j++) {
|
||||
subTotal += hex.blocks[i][j].deleted;
|
||||
}
|
||||
for (var i = 0; i < hex.sides; i++) {
|
||||
var subTotal = 0;
|
||||
for (var j = 0; j < hex.blocks[i].length; j++) {
|
||||
subTotal += hex.blocks[i][j].deleted;
|
||||
}
|
||||
|
||||
if (hex.blocks[i].length - subTotal > settings.rows) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if (hex.blocks[i].length - subTotal > settings.rows) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkGameOver() {
|
||||
for (var i = 0; i < MainHex.sides; i++) {
|
||||
if (isInfringing(MainHex)) {
|
||||
$.get('http://54.183.184.126/' + String(score))
|
||||
if (highscores.indexOf(score) == -1) {
|
||||
highscores.push(score);
|
||||
}
|
||||
writeHighScores();
|
||||
gameOverDisplay();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
for (var i = 0; i < MainHex.sides; i++) {
|
||||
if (isInfringing(MainHex)) {
|
||||
$.get('http://54.183.184.126/' + String(score))
|
||||
if (highscores.indexOf(score) == -1) {
|
||||
highscores.push(score);
|
||||
}
|
||||
writeHighScores();
|
||||
gameOverDisplay();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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"));
|
||||
if (gameState == 1) {
|
||||
pause();
|
||||
}
|
||||
$("#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) {
|
||||
pause();
|
||||
}
|
||||
|
||||
if($("#pauseBtn").children()[0].src.replace(/^.*[\\\/]/, '') == "btn_pause.svg" && gameState != 0 && !infobuttonfading) {
|
||||
return;
|
||||
}
|
||||
if($("#pauseBtn").children()[0].src.replace(/^.*[\\\/]/, '') == "btn_pause.svg" && gameState != 0 && !infobuttonfading) {
|
||||
return;
|
||||
}
|
||||
|
||||
$("#openSideBar").fadeIn(150,"linear");
|
||||
$('#helpScreen').fadeToggle(150, "linear");
|
||||
$("#openSideBar").fadeIn(150,"linear");
|
||||
$('#helpScreen').fadeToggle(150, "linear");
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
function rotatePoint(x, y, theta) {
|
||||
var thetaRad = theta * (Math.PI / 180);
|
||||
var rotX = Math.cos(thetaRad) * x - Math.sin(thetaRad) * y;
|
||||
var rotY = Math.sin(thetaRad) * x + Math.cos(thetaRad) * y;
|
||||
var thetaRad = theta * (Math.PI / 180);
|
||||
var rotX = Math.cos(thetaRad) * x - Math.sin(thetaRad) * y;
|
||||
var rotY = Math.sin(thetaRad) * x + Math.cos(thetaRad) * y;
|
||||
|
||||
return {
|
||||
x: rotX,
|
||||
y: rotY
|
||||
};
|
||||
return {
|
||||
x: rotX,
|
||||
y: rotY
|
||||
};
|
||||
}
|
||||
|
||||
function randInt(min, max) {
|
||||
return Math.floor((Math.random() * max) + min);
|
||||
return Math.floor((Math.random() * max) + min);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ function descaleBlock(b) {
|
|||
}
|
||||
|
||||
function writeHighScores() {
|
||||
highscores.sort(
|
||||
highscores.sort(
|
||||
function(a,b){
|
||||
a = parseInt(a, 10);
|
||||
b = parseInt(b, 10);
|
||||
|
|
410
js_v9/view.js
|
@ -1,253 +1,253 @@
|
|||
// t: current time, b: begInnIng value, c: change In value, d: duration
|
||||
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) {
|
||||
if (text == 'HIGH SCORE') debugger;
|
||||
ctx.save();
|
||||
if (!font) {
|
||||
font = 'px/0 Roboto';
|
||||
}
|
||||
if (text == 'HIGH SCORE') debugger;
|
||||
ctx.save();
|
||||
if (!font) {
|
||||
font = 'px/0 Roboto';
|
||||
}
|
||||
|
||||
fontSize *= settings.scale;
|
||||
ctx.font = fontSize + font;
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillStyle = color;
|
||||
ctx.fillText(text, x, y + (fontSize / 2) - 9 * settings.scale);
|
||||
ctx.restore();
|
||||
fontSize *= settings.scale;
|
||||
ctx.font = fontSize + font;
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillStyle = color;
|
||||
ctx.fillText(text, x, y + (fontSize / 2) - 9 * settings.scale);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function drawScoreboard() {
|
||||
if (scoreOpacity < 1) {
|
||||
scoreOpacity += 0.01;
|
||||
textOpacity += 0.01;
|
||||
}
|
||||
if (scoreOpacity < 1) {
|
||||
scoreOpacity += 0.01;
|
||||
textOpacity += 0.01;
|
||||
}
|
||||
|
||||
ctx.globalAlpha = textOpacity;
|
||||
var scoreSize = 50;
|
||||
var scoreString = String(score);
|
||||
if (scoreString.length == 6) {
|
||||
scoreSize = 43;
|
||||
} else if (scoreString.length == 7) {
|
||||
scoreSize = 35;
|
||||
} else if (scoreString.length == 8) {
|
||||
scoreSize = 31;
|
||||
} else if (scoreString.length == 9) {
|
||||
scoreSize = 27;
|
||||
}
|
||||
if (rush ==1){
|
||||
var color = "rgb(236, 240, 241)";
|
||||
}
|
||||
else{
|
||||
var color = "#e74c3c";
|
||||
}
|
||||
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 - 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!');
|
||||
} else if (gameState != 0 && textOpacity > 0) {
|
||||
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 - 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!');
|
||||
ctx.globalAlpha = scoreOpacity;
|
||||
renderText(trueCanvas.width / 2 + gdx, trueCanvas.height / 2 + gdy, scoreSize, color, score);
|
||||
} else {
|
||||
ctx.globalAlpha = scoreOpacity;
|
||||
renderText(trueCanvas.width / 2 + gdx, trueCanvas.height / 2 + gdy, scoreSize, color, score);
|
||||
}
|
||||
ctx.globalAlpha = textOpacity;
|
||||
var scoreSize = 50;
|
||||
var scoreString = String(score);
|
||||
if (scoreString.length == 6) {
|
||||
scoreSize = 43;
|
||||
} else if (scoreString.length == 7) {
|
||||
scoreSize = 35;
|
||||
} else if (scoreString.length == 8) {
|
||||
scoreSize = 31;
|
||||
} else if (scoreString.length == 9) {
|
||||
scoreSize = 27;
|
||||
}
|
||||
if (rush ==1){
|
||||
var color = "rgb(236, 240, 241)";
|
||||
}
|
||||
else{
|
||||
var color = "#e74c3c";
|
||||
}
|
||||
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 - 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!');
|
||||
} else if (gameState != 0 && textOpacity > 0) {
|
||||
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 - 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!');
|
||||
ctx.globalAlpha = scoreOpacity;
|
||||
renderText(trueCanvas.width / 2 + gdx, trueCanvas.height / 2 + gdy, scoreSize, color, score);
|
||||
} else {
|
||||
ctx.globalAlpha = scoreOpacity;
|
||||
renderText(trueCanvas.width / 2 + gdx, trueCanvas.height / 2 + gdy, scoreSize, color, score);
|
||||
}
|
||||
|
||||
ctx.globalAlpha = 1;
|
||||
ctx.globalAlpha = 1;
|
||||
}
|
||||
|
||||
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) {
|
||||
ctx.fillStyle = fillColor;
|
||||
ctx.lineWidth = lineWidth;
|
||||
ctx.strokeStyle = lineColor;
|
||||
ctx.fillStyle = fillColor;
|
||||
ctx.lineWidth = lineWidth;
|
||||
ctx.strokeStyle = lineColor;
|
||||
|
||||
ctx.beginPath();
|
||||
var coords = rotatePoint(0, radius, theta);
|
||||
ctx.moveTo(coords.x + x, coords.y + y);
|
||||
var oldX = coords.x;
|
||||
var oldY = coords.y;
|
||||
for (var i = 0; i < sides; i++) {
|
||||
coords = rotatePoint(oldX, oldY, 360 / sides);
|
||||
ctx.lineTo(coords.x + x, coords.y + y);
|
||||
oldX = coords.x;
|
||||
oldY = coords.y;
|
||||
}
|
||||
ctx.beginPath();
|
||||
var coords = rotatePoint(0, radius, theta);
|
||||
ctx.moveTo(coords.x + x, coords.y + y);
|
||||
var oldX = coords.x;
|
||||
var oldY = coords.y;
|
||||
for (var i = 0; i < sides; i++) {
|
||||
coords = rotatePoint(oldX, oldY, 360 / sides);
|
||||
ctx.lineTo(coords.x + x, coords.y + y);
|
||||
oldX = coords.x;
|
||||
oldY = coords.y;
|
||||
}
|
||||
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
ctx.stroke();
|
||||
ctx.strokeStyle = 'rgba(0,0,0,0)';
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
ctx.stroke();
|
||||
ctx.strokeStyle = 'rgba(0,0,0,0)';
|
||||
}
|
||||
|
||||
function toggleClass(element, active) {
|
||||
if ($(element).hasClass(active)) {
|
||||
$(element).removeClass(active);
|
||||
} else {
|
||||
$(element).addClass(active);
|
||||
}
|
||||
if ($(element).hasClass(active)) {
|
||||
$(element).removeClass(active);
|
||||
} else {
|
||||
$(element).addClass(active);
|
||||
}
|
||||
}
|
||||
|
||||
function showText(text) {
|
||||
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>",
|
||||
'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>",
|
||||
'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'> "
|
||||
};
|
||||
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>",
|
||||
'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>",
|
||||
'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 (settings.os == 'android') {
|
||||
text = 'pausedAndroid';
|
||||
}
|
||||
}
|
||||
if (text == 'paused') {
|
||||
if (settings.os == 'android') {
|
||||
text = 'pausedAndroid';
|
||||
}
|
||||
}
|
||||
|
||||
if (text == 'gameover') {
|
||||
//Clay('client.share.any', {text: 'Think you can beat my score of '+ score + ' in Super Cool Game?'})
|
||||
var allZ = 1;
|
||||
var i;
|
||||
if (text == 'gameover') {
|
||||
//Clay('client.share.any', {text: 'Think you can beat my score of '+ score + ' in Super Cool Game?'})
|
||||
var allZ = 1;
|
||||
var i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (highscores.length > i) {
|
||||
messages['gameover'] += "<tr> <th class='tg-031e'>" + (i + 1) + ".</th> <th class='tg-031e'>" + highscores[i] + " pts</th> </tr>";
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (highscores.length > i) {
|
||||
messages['gameover'] += "<tr> <th class='tg-031e'>" + (i + 1) + ".</th> <th class='tg-031e'>" + highscores[i] + " pts</th> </tr>";
|
||||
}
|
||||
}
|
||||
|
||||
var restartText;
|
||||
if (settings.platform == 'mobile') {
|
||||
restartText = 'Tap anywhere to restart!';
|
||||
} else {
|
||||
restartText = 'Press enter (or click anywhere!) to restart!';
|
||||
}
|
||||
var restartText;
|
||||
if (settings.platform == 'mobile') {
|
||||
restartText = 'Tap anywhere to restart!';
|
||||
} else {
|
||||
restartText = 'Press enter (or click anywhere!) to restart!';
|
||||
}
|
||||
|
||||
messages['gameover'] += "</table><br><div class='unselectable centeredSubHeader' id = 'tapToRestart'>" + restartText + "</div>";
|
||||
if (allZ) {
|
||||
for (i = 0; i < highscores.length; i++) {
|
||||
if (highscores[i] !== 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>"
|
||||
$(".overlay").html(messages[text]);
|
||||
$(".overlay").fadeIn("1000", "swing");
|
||||
messages['gameover'] += "</table><br><div class='unselectable centeredSubHeader' id = 'tapToRestart'>" + restartText + "</div>";
|
||||
if (allZ) {
|
||||
for (i = 0; i < highscores.length; i++) {
|
||||
if (highscores[i] !== 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>"
|
||||
$(".overlay").html(messages[text]);
|
||||
$(".overlay").fadeIn("1000", "swing");
|
||||
|
||||
if (text == 'gameover') {
|
||||
if (settings.platform == 'mobile') {
|
||||
$('.tg').css('margin-top', '6px');
|
||||
$("#tapToRestart").css('margin-top','-19px')
|
||||
}
|
||||
}
|
||||
if (text == 'gameover') {
|
||||
if (settings.platform == 'mobile') {
|
||||
$('.tg').css('margin-top', '6px');
|
||||
$("#tapToRestart").css('margin-top','-19px')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setMainMenu() {
|
||||
gameState = 4;
|
||||
canRestart = false;
|
||||
setTimeout(function() {
|
||||
canRestart = 's';
|
||||
}, 500);
|
||||
$('#restartBtn').hide();
|
||||
if ($("#pauseBtn").replace(/^.*[\\\/]/, '') == "btn_pause.svg") {
|
||||
$("#pauseBtn").attr("src","./images/btn_resume.svg");
|
||||
} else {
|
||||
$("#pauseBtn").attr("src","./images/btn_pause.svg");
|
||||
}
|
||||
gameState = 4;
|
||||
canRestart = false;
|
||||
setTimeout(function() {
|
||||
canRestart = 's';
|
||||
}, 500);
|
||||
$('#restartBtn').hide();
|
||||
if ($("#pauseBtn").replace(/^.*[\\\/]/, '') == "btn_pause.svg") {
|
||||
$("#pauseBtn").attr("src","./images/btn_resume.svg");
|
||||
} else {
|
||||
$("#pauseBtn").attr("src","./images/btn_pause.svg");
|
||||
}
|
||||
}
|
||||
|
||||
function hideText() {
|
||||
$(".overlay").fadeOut("1000", function() {
|
||||
$(".overlay").html("");
|
||||
})
|
||||
$(".overlay").fadeOut("1000", function() {
|
||||
$(".overlay").html("");
|
||||
})
|
||||
}
|
||||
|
||||
function gameOverDisplay() {
|
||||
if( localStorage.getItem("been_mobile") != "true" || true){
|
||||
settings.ending_block=true;
|
||||
if(settings.os == "android"){
|
||||
sweetAlert({
|
||||
title: "Hey we'll only bother you once ",
|
||||
text:"We do have an Android app!",
|
||||
showCancelButton: true,
|
||||
closeOnCancel: true ,
|
||||
confirmButtonText: "Take me to it!",
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
window.location.href="https://play.google.com/store/apps/details?id=com.hextris.hextris"
|
||||
}
|
||||
else{
|
||||
settings.end_block=false;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
if(settings.os == "ios"){
|
||||
sweetAlert({
|
||||
title: "Hey we'll only bother you once ",
|
||||
text:"We do have an IOS app!",
|
||||
showCancelButton: true,
|
||||
closeOnCancel: true ,
|
||||
confirmButtonText: "Take me to it!",
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
window.location.href="https://itunes.apple.com/us/app/hextris/id903769553?mt=8";
|
||||
}
|
||||
else{
|
||||
settings.end_block=false;
|
||||
}
|
||||
});
|
||||
}
|
||||
if( localStorage.getItem("been_mobile") != "true" || true){
|
||||
settings.ending_block=true;
|
||||
if(settings.os == "android"){
|
||||
sweetAlert({
|
||||
title: "Hey we'll only bother you once ",
|
||||
text:"We do have an Android app!",
|
||||
showCancelButton: true,
|
||||
closeOnCancel: true ,
|
||||
confirmButtonText: "Take me to it!",
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
window.location.href="https://play.google.com/store/apps/details?id=com.hextris.hextris"
|
||||
}
|
||||
else{
|
||||
settings.end_block=false;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
if(settings.os == "ios"){
|
||||
sweetAlert({
|
||||
title: "Hey we'll only bother you once ",
|
||||
text:"We do have an IOS app!",
|
||||
showCancelButton: true,
|
||||
closeOnCancel: true ,
|
||||
confirmButtonText: "Take me to it!",
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
window.location.href="https://itunes.apple.com/us/app/hextris/id903769553?mt=8";
|
||||
}
|
||||
else{
|
||||
settings.end_block=false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
localStorage.setItem("been_mobile", "true");
|
||||
$("#attributions").show();
|
||||
var c = document.getElementById("canvas");
|
||||
c.className = "blur";
|
||||
showText('gameover');
|
||||
showbottombar();
|
||||
}
|
||||
localStorage.setItem("been_mobile", "true");
|
||||
$("#attributions").show();
|
||||
var c = document.getElementById("canvas");
|
||||
c.className = "blur";
|
||||
showText('gameover');
|
||||
showbottombar();
|
||||
}
|
||||
|
||||
function pause(o) {
|
||||
writeHighScores();
|
||||
var message;
|
||||
if (o) {
|
||||
message = '';
|
||||
} else {
|
||||
message = 'paused';
|
||||
}
|
||||
writeHighScores();
|
||||
var message;
|
||||
if (o) {
|
||||
message = '';
|
||||
} else {
|
||||
message = 'paused';
|
||||
}
|
||||
|
||||
var c = document.getElementById("canvas");
|
||||
if (gameState == -1) {
|
||||
$('#restartBtn').fadeOut(150, "linear");
|
||||
if ($('#helpScreen').is(':visible')) {
|
||||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
var c = document.getElementById("canvas");
|
||||
if (gameState == -1) {
|
||||
$('#restartBtn').fadeOut(150, "linear");
|
||||
if ($('#helpScreen').is(':visible')) {
|
||||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
|
||||
$("#pauseBtn").attr("src", "./images/btn_pause.svg");
|
||||
$('.helpText').fadeOut(200, 'linear');
|
||||
hideText();
|
||||
hidebottombar();
|
||||
setTimeout(function() {
|
||||
gameState = prevGameState;
|
||||
}, 200)
|
||||
} else if (gameState != -2 && gameState !== 0 && gameState !== 2) {
|
||||
$('#restartBtn').fadeIn(150, "linear");
|
||||
$('.helpText').fadeIn(200, 'linear');
|
||||
showbottombar();
|
||||
if (message == 'paused') {
|
||||
showText(message);
|
||||
}
|
||||
$("#pauseBtn").attr("src", "./images/btn_pause.svg");
|
||||
$('.helpText').fadeOut(200, 'linear');
|
||||
hideText();
|
||||
hidebottombar();
|
||||
setTimeout(function() {
|
||||
gameState = prevGameState;
|
||||
}, 200)
|
||||
} else if (gameState != -2 && gameState !== 0 && gameState !== 2) {
|
||||
$('#restartBtn').fadeIn(150, "linear");
|
||||
$('.helpText').fadeIn(200, 'linear');
|
||||
showbottombar();
|
||||
if (message == 'paused') {
|
||||
showText(message);
|
||||
}
|
||||
|
||||
$("#pauseBtn").attr("src","./images/btn_resume.svg");
|
||||
prevGameState = gameState;
|
||||
gameState = -1;
|
||||
}
|
||||
$("#pauseBtn").attr("src","./images/btn_resume.svg");
|
||||
prevGameState = gameState;
|
||||
gameState = -1;
|
||||
}
|
||||
}
|
||||
|
|
354
js_v9/wavegen.js
|
@ -1,201 +1,201 @@
|
|||
function blockDestroyed() {
|
||||
if (waveone.nextGen > 1350) {
|
||||
waveone.nextGen -= 30 * settings.creationSpeedModifier;
|
||||
} else if (waveone.nextGen > 600) {
|
||||
waveone.nextGen -= 8 * settings.creationSpeedModifier;
|
||||
} else {
|
||||
waveone.nextGen = 600;
|
||||
}
|
||||
if (waveone.nextGen > 1350) {
|
||||
waveone.nextGen -= 30 * settings.creationSpeedModifier;
|
||||
} else if (waveone.nextGen > 600) {
|
||||
waveone.nextGen -= 8 * settings.creationSpeedModifier;
|
||||
} else {
|
||||
waveone.nextGen = 600;
|
||||
}
|
||||
|
||||
if (waveone.difficulty < 35) {
|
||||
waveone.difficulty += 0.085 * settings.speedModifier;
|
||||
} else {
|
||||
waveone.difficulty = 35;
|
||||
}
|
||||
if (waveone.difficulty < 35) {
|
||||
waveone.difficulty += 0.085 * settings.speedModifier;
|
||||
} else {
|
||||
waveone.difficulty = 35;
|
||||
}
|
||||
}
|
||||
|
||||
function waveGen(hex) {
|
||||
this.lastGen = 0;
|
||||
this.last = 0;
|
||||
this.nextGen = 2700;
|
||||
this.start = 0;
|
||||
this.colors = colors;
|
||||
this.ct = 0;
|
||||
this.hex = hex;
|
||||
this.difficulty = 1;
|
||||
this.dt = 0;
|
||||
this.update = function() {
|
||||
this.currentFunction();
|
||||
this.dt = (settings.platform == 'mobile' ? 14 : 16.6667) * MainHex.ct;
|
||||
this.computeDifficulty();
|
||||
if ((this.dt - this.lastGen) * settings.creationSpeedModifier > this.nextGen) {
|
||||
if (this.nextGen > 600) {
|
||||
this.nextGen -= 11 * ((this.nextGen / 1300)) * settings.creationSpeedModifier;
|
||||
}
|
||||
}
|
||||
};
|
||||
this.lastGen = 0;
|
||||
this.last = 0;
|
||||
this.nextGen = 2700;
|
||||
this.start = 0;
|
||||
this.colors = colors;
|
||||
this.ct = 0;
|
||||
this.hex = hex;
|
||||
this.difficulty = 1;
|
||||
this.dt = 0;
|
||||
this.update = function() {
|
||||
this.currentFunction();
|
||||
this.dt = (settings.platform == 'mobile' ? 14 : 16.6667) * MainHex.ct;
|
||||
this.computeDifficulty();
|
||||
if ((this.dt - this.lastGen) * settings.creationSpeedModifier > this.nextGen) {
|
||||
if (this.nextGen > 600) {
|
||||
this.nextGen -= 11 * ((this.nextGen / 1300)) * settings.creationSpeedModifier;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.randomGeneration = function() {
|
||||
if (this.dt - this.lastGen > this.nextGen) {
|
||||
this.ct++;
|
||||
this.lastGen = this.dt;
|
||||
var fv = randInt(0, MainHex.sides);
|
||||
addNewBlock(fv, colors[randInt(0, colors.length)], 1.6 + (this.difficulty / 15) * 3);
|
||||
var lim = 5;
|
||||
if (this.ct > lim) {
|
||||
var nextPattern = randInt(0, 3 + 21);
|
||||
if (nextPattern > 15) {
|
||||
this.ct = 0;
|
||||
this.currentFunction = this.doubleGeneration;
|
||||
} else if (nextPattern > 10) {
|
||||
this.ct = 0;
|
||||
this.currentFunction = this.crosswiseGeneration;
|
||||
} else if (nextPattern > 7) {
|
||||
this.ct = 0;
|
||||
this.currentFunction = this.spiralGeneration;
|
||||
} else if (nextPattern > 4) {
|
||||
this.ct = 0;
|
||||
this.currentFunction = this.circleGeneration;
|
||||
} else if (nextPattern > 1) {
|
||||
this.ct = 0;
|
||||
this.currentFunction = this.halfCircleGeneration;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
this.randomGeneration = function() {
|
||||
if (this.dt - this.lastGen > this.nextGen) {
|
||||
this.ct++;
|
||||
this.lastGen = this.dt;
|
||||
var fv = randInt(0, MainHex.sides);
|
||||
addNewBlock(fv, colors[randInt(0, colors.length)], 1.6 + (this.difficulty / 15) * 3);
|
||||
var lim = 5;
|
||||
if (this.ct > lim) {
|
||||
var nextPattern = randInt(0, 3 + 21);
|
||||
if (nextPattern > 15) {
|
||||
this.ct = 0;
|
||||
this.currentFunction = this.doubleGeneration;
|
||||
} else if (nextPattern > 10) {
|
||||
this.ct = 0;
|
||||
this.currentFunction = this.crosswiseGeneration;
|
||||
} else if (nextPattern > 7) {
|
||||
this.ct = 0;
|
||||
this.currentFunction = this.spiralGeneration;
|
||||
} else if (nextPattern > 4) {
|
||||
this.ct = 0;
|
||||
this.currentFunction = this.circleGeneration;
|
||||
} else if (nextPattern > 1) {
|
||||
this.ct = 0;
|
||||
this.currentFunction = this.halfCircleGeneration;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.computeDifficulty = function() {
|
||||
if (this.difficulty < 35) {
|
||||
var increment;
|
||||
if (this.difficulty < 8) {
|
||||
increment = (this.dt - this.last) / (5166667) * settings.speedModifier;
|
||||
} else if (this.difficulty < 15) {
|
||||
increment = (this.dt - this.last) / (72333333) * settings.speedModifier;
|
||||
} else {
|
||||
increment = (this.dt - this.last) / (90000000) * settings.speedModifier;
|
||||
}
|
||||
this.computeDifficulty = function() {
|
||||
if (this.difficulty < 35) {
|
||||
var increment;
|
||||
if (this.difficulty < 8) {
|
||||
increment = (this.dt - this.last) / (5166667) * settings.speedModifier;
|
||||
} else if (this.difficulty < 15) {
|
||||
increment = (this.dt - this.last) / (72333333) * settings.speedModifier;
|
||||
} else {
|
||||
increment = (this.dt - this.last) / (90000000) * settings.speedModifier;
|
||||
}
|
||||
|
||||
this.difficulty += increment * (1/2);
|
||||
}
|
||||
};
|
||||
this.difficulty += increment * (1/2);
|
||||
}
|
||||
};
|
||||
|
||||
this.circleGeneration = function() {
|
||||
if (this.dt - this.lastGen > this.nextGen + 500) {
|
||||
var numColors = randInt(1, 4);
|
||||
if (numColors == 3) {
|
||||
numColors = randInt(1, 4);
|
||||
}
|
||||
this.circleGeneration = function() {
|
||||
if (this.dt - this.lastGen > this.nextGen + 500) {
|
||||
var numColors = randInt(1, 4);
|
||||
if (numColors == 3) {
|
||||
numColors = randInt(1, 4);
|
||||
}
|
||||
|
||||
var colorList = [];
|
||||
nextLoop: for (var i = 0; i < numColors; i++) {
|
||||
var q = randInt(0, colors.length);
|
||||
for (var j in colorList) {
|
||||
if (colorList[j] == colors[q]) {
|
||||
i--;
|
||||
continue nextLoop;
|
||||
}
|
||||
}
|
||||
colorList.push(colors[q]);
|
||||
}
|
||||
var colorList = [];
|
||||
nextLoop: for (var i = 0; i < numColors; i++) {
|
||||
var q = randInt(0, colors.length);
|
||||
for (var j in colorList) {
|
||||
if (colorList[j] == colors[q]) {
|
||||
i--;
|
||||
continue nextLoop;
|
||||
}
|
||||
}
|
||||
colorList.push(colors[q]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < MainHex.sides; i++) {
|
||||
addNewBlock(i, colorList[i % numColors], 1.5 + (this.difficulty / 15) * 3);
|
||||
}
|
||||
for (var i = 0; i < MainHex.sides; i++) {
|
||||
addNewBlock(i, colorList[i % numColors], 1.5 + (this.difficulty / 15) * 3);
|
||||
}
|
||||
|
||||
this.ct += 15;
|
||||
this.lastGen = this.dt;
|
||||
this.shouldChangePattern(1);
|
||||
}
|
||||
};
|
||||
this.ct += 15;
|
||||
this.lastGen = this.dt;
|
||||
this.shouldChangePattern(1);
|
||||
}
|
||||
};
|
||||
|
||||
this.halfCircleGeneration = function() {
|
||||
if (this.dt - this.lastGen > (this.nextGen + 500) / 2) {
|
||||
var numColors = randInt(1, 3);
|
||||
var c = colors[randInt(0, colors.length)];
|
||||
var colorList = [c, c, c];
|
||||
if (numColors == 2) {
|
||||
colorList = [c, colors[randInt(0, colors.length)], c];
|
||||
}
|
||||
this.halfCircleGeneration = function() {
|
||||
if (this.dt - this.lastGen > (this.nextGen + 500) / 2) {
|
||||
var numColors = randInt(1, 3);
|
||||
var c = colors[randInt(0, colors.length)];
|
||||
var colorList = [c, c, c];
|
||||
if (numColors == 2) {
|
||||
colorList = [c, colors[randInt(0, colors.length)], c];
|
||||
}
|
||||
|
||||
var d = randInt(0, 6);
|
||||
for (var i = 0; i < 3; i++) {
|
||||
addNewBlock((d + i) % 6, colorList[i], 1.5 + (this.difficulty / 15) * 3);
|
||||
}
|
||||
var d = randInt(0, 6);
|
||||
for (var i = 0; i < 3; i++) {
|
||||
addNewBlock((d + i) % 6, colorList[i], 1.5 + (this.difficulty / 15) * 3);
|
||||
}
|
||||
|
||||
this.ct += 8;
|
||||
this.lastGen = this.dt;
|
||||
this.shouldChangePattern();
|
||||
}
|
||||
};
|
||||
this.ct += 8;
|
||||
this.lastGen = this.dt;
|
||||
this.shouldChangePattern();
|
||||
}
|
||||
};
|
||||
|
||||
this.crosswiseGeneration = function() {
|
||||
if (this.dt - this.lastGen > this.nextGen) {
|
||||
var ri = randInt(0, colors.length);
|
||||
var i = randInt(0, colors.length);
|
||||
addNewBlock(i, 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.lastGen = this.dt;
|
||||
this.shouldChangePattern();
|
||||
}
|
||||
};
|
||||
this.crosswiseGeneration = function() {
|
||||
if (this.dt - this.lastGen > this.nextGen) {
|
||||
var ri = randInt(0, colors.length);
|
||||
var i = randInt(0, colors.length);
|
||||
addNewBlock(i, 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.lastGen = this.dt;
|
||||
this.shouldChangePattern();
|
||||
}
|
||||
};
|
||||
|
||||
this.spiralGeneration = function() {
|
||||
var dir = randInt(0, 2);
|
||||
if (this.dt - this.lastGen > this.nextGen * (2 / 3)) {
|
||||
if (dir) {
|
||||
addNewBlock(5 - (this.ct % MainHex.sides), colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * (3 / 2));
|
||||
} else {
|
||||
addNewBlock(this.ct % MainHex.sides, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * (3 / 2));
|
||||
}
|
||||
this.ct += 1;
|
||||
this.lastGen = this.dt;
|
||||
this.shouldChangePattern();
|
||||
}
|
||||
};
|
||||
this.spiralGeneration = function() {
|
||||
var dir = randInt(0, 2);
|
||||
if (this.dt - this.lastGen > this.nextGen * (2 / 3)) {
|
||||
if (dir) {
|
||||
addNewBlock(5 - (this.ct % MainHex.sides), colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * (3 / 2));
|
||||
} else {
|
||||
addNewBlock(this.ct % MainHex.sides, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * (3 / 2));
|
||||
}
|
||||
this.ct += 1;
|
||||
this.lastGen = this.dt;
|
||||
this.shouldChangePattern();
|
||||
}
|
||||
};
|
||||
|
||||
this.doubleGeneration = function() {
|
||||
if (this.dt - this.lastGen > this.nextGen) {
|
||||
var i = randInt(0, colors.length);
|
||||
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);
|
||||
this.ct += 2;
|
||||
this.lastGen = this.dt;
|
||||
this.shouldChangePattern();
|
||||
}
|
||||
};
|
||||
this.doubleGeneration = function() {
|
||||
if (this.dt - this.lastGen > this.nextGen) {
|
||||
var i = randInt(0, colors.length);
|
||||
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);
|
||||
this.ct += 2;
|
||||
this.lastGen = this.dt;
|
||||
this.shouldChangePattern();
|
||||
}
|
||||
};
|
||||
|
||||
this.setRandom = function() {
|
||||
this.ct = 0;
|
||||
this.currentFunction = this.randomGeneration;
|
||||
};
|
||||
this.setRandom = function() {
|
||||
this.ct = 0;
|
||||
this.currentFunction = this.randomGeneration;
|
||||
};
|
||||
|
||||
this.shouldChangePattern = function(x) {
|
||||
if (x) {
|
||||
var q = randInt(0, 4);
|
||||
this.ct = 0;
|
||||
switch (q) {
|
||||
case 0:
|
||||
this.currentFunction = this.doubleGeneration;
|
||||
break;
|
||||
case 1:
|
||||
this.currentFunction = this.spiralGeneration;
|
||||
break;
|
||||
case 2:
|
||||
this.currentFunction = this.crosswiseGeneration;
|
||||
break;
|
||||
}
|
||||
} else if (this.ct > 8) {
|
||||
if (randInt(0, 2) === 0) {
|
||||
this.setRandom();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
this.shouldChangePattern = function(x) {
|
||||
if (x) {
|
||||
var q = randInt(0, 4);
|
||||
this.ct = 0;
|
||||
switch (q) {
|
||||
case 0:
|
||||
this.currentFunction = this.doubleGeneration;
|
||||
break;
|
||||
case 1:
|
||||
this.currentFunction = this.spiralGeneration;
|
||||
break;
|
||||
case 2:
|
||||
this.currentFunction = this.crosswiseGeneration;
|
||||
break;
|
||||
}
|
||||
} else if (this.ct > 8) {
|
||||
if (randInt(0, 2) === 0) {
|
||||
this.setRandom();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
|
||||
// rest of generation functions
|
||||
// rest of generation functions
|
||||
|
||||
this.currentFunction = this.randomGeneration;
|
||||
this.currentFunction = this.randomGeneration;
|
||||
}
|
||||
|
|
20
style/fa/css/font-awesome.css
vendored
|
@ -85,36 +85,36 @@
|
|||
}
|
||||
@-moz-keyframes spin {
|
||||
0% {
|
||||
-moz-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-moz-transform: rotate(359deg);
|
||||
-moz-transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotate(359deg);
|
||||
-webkit-transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
@-o-keyframes spin {
|
||||
0% {
|
||||
-o-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-o-transform: rotate(359deg);
|
||||
-o-transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
@keyframes spin {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg);
|
||||
}
|
||||
}
|
||||
.fa-rotate-90 {
|
||||
|
|