Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s-a/hex-board-game
https://github.com/s-a/hex-board-game
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/s-a/hex-board-game
- Owner: s-a
- License: mit
- Created: 2015-02-21T09:11:35.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-23T05:59:00.000Z (almost 10 years ago)
- Last Synced: 2025-01-17T01:12:48.370Z (about 1 month ago)
- Language: JavaScript
- Homepage: http://s-a.github.io/hex-board-game/
- Size: 2.06 MB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.MD
- License: LICENSE
Awesome Lists containing this project
README
# hex-board-game (work in progress...)
## Install with bower
```bower install hex-board-game```## Try the test
- Open ```http://localhost/YOUR_PRORJECT/bower_components/hex-board-game/``` in browser. (some requests need a webserver so the demo cannot run from filesystem!)Set current zoom scale:
```
game.GUI.board.zoom([INTEGER 1-8]);
```Set current viewpoint:
```
game.GUI.board.viewPoint = {
x:-110,
y:-0
};
```Currently there is a mockup function fetching the hex map data. You can overwrite this method to fetch your data from server.
``` javascript
(function($, game, Field) {
GUI.prototype.board.fetchData = function (ordinate, onComplete) {
var self = this;
this.GUI.$loading.show();
var rows = [];for (var x = ordinate.x1; x < ordinate.x2; x++) {
var row = [];
for (var y = ordinate.y1; y < ordinate.y2; y++) {
var fieldParms = {
position : {
x : x,
y : y
}
};
row.push(new Field(fieldParms));
}
rows.push(row);
}window.setTimeout((function() {
onComplete(rows);
self.GUI.$loading.hide();
}), 800);
};
})(window.jQuery, window.game, window.game.class.Field);
```Todo; Write the docs;