-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
46 lines (38 loc) · 1.07 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var fastclick = require('fastclick').FastClick
fastclick.attach(document.body)
var config = {
moves: 6
}
var map = {
tiles: [
{coordinates: [0, 0], paths: [0, 2, 4], cue: {id: 0}},
{coordinates: [-1, 0], paths: [0, 4, 5], cue: {id: 1}},
{coordinates: [0, 1], paths: [2, 3, 4]},
{coordinates: [-1, 1], paths: [4, 5], cue: {id: 2}},
{coordinates: [1, -1], paths: [2, 3]},
{coordinates: [1, 0], paths: [1, 3]},
{coordinates: [0, -1], paths: [1, 3, 5]},
{coordinates: [0, -2], paths: [0, 5]},
{coordinates: [1, -2], paths: [0, 2], cue: {id: 3}},
]
}
var schema = {
config: config,
map: map
}
var container = document.getElementById('container')
var canvas = document.createElement('canvas')
canvas.height = container.clientHeight
canvas.width = container.clientWidth
var gl = canvas.getContext('webgl')
container.appendChild(canvas)
var controller = require('crtrdg-keyboard')()
var game = require('hexaworld-core')({
schema: schema,
controller: controller
})
var renderer = require('./index.js')({
game: game,
gl: gl
})
game.start()