Check the position and type of the touch event to determine whether acceleration is being applied. The only issue with this is that if a touch moves from the right of the screen to the left, if a touchend event occurs in the left side of the screen, it won't stop the acceleration. But it's a better solution than counting the number of touches. Also added a check on touch move events, so that only moves which occur on the left of the screen are counted as turns. The reason for this is that in some cases, the touch identifier was being incorrectly applied: so a touch which started on the left of the screen could accidentally be continued by a touchmove occurring on the right of the screen, resulting in a violent right turn. (It appears as though the touch ID can mistakenly transfer between touches with different fingers.) By testing where the touchmove occurs, the violent turn effect can be removed, as only a finger on the left-hand side of the screen can cause moves.
HexGL
Source code of HexGL, the futuristic HTML5 racing game by Thibaut Despoulain
Branches
- Master - Public release (stable), same version as on the website.
- Dev - Latest revisions (highly unstable).
License
Unless specified in the file, HexGL's code and resources are licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/.
If you feel like you deserve another license for a special case, drop me a note, and we'll talk about it.
Installation
cd ~/
git clone git://github.com/BKcore/HexGL.git
cd HexGL
python -m SimpleHTTPServer
chromium index.html
To use full size textures, swap the two textures/ and textures.full/ directories.
Regarding the code
As of now the code is pretty much raw and undocumented. I'll be commenting it someday, but that won't be until I've finished the next content update and code refactoring sorry! There will also be some refactoring, when I get some time :P
Note
After much thinking, I've decided to release HexGL's source code under CC 3.0 BY-NC until further notice. This is not a definite choice, and the game may end up under the MIT license someday.
Feel free to post issues, patch or anything to make the game better.