-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyboard.coffee
39 lines (32 loc) · 1.28 KB
/
keyboard.coffee
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
class Keyboard
constructor: (game,graphics) ->
@graphics = graphics
@game = game
@center = new THREE.Vector3(0,0,0)
@angle = Math.TAU / World.CIRCUMFERENCE
@target
@speed = 0
@dir
key 'p','game', => @game.pause = [email protected]
key 'r','game', => @game.restart()
key 'f','game', => @game.finish()
key 'enter','tutorial', => @game.seedMode()
key 'up','menu', => @game.onUp?()
key 'down','menu', => @game.onDown?()
key 'left','menu', => @game.onLeft?()
key 'right','menu', => @game.onRight?()
key 'space','menu', => @game.onSpace?()
key '1','menu', => @game.selectTile(0)
key '2','menu', => @game.selectTile(1)
key '3','menu', => @game.selectTile(2)
key '4','menu', => @game.selectTile(3)
key '5','menu', => @game.selectTile(4)
key 'c','menu', => @game.world.reset()
key 'h', => @game.toggleHelp()
key 'w', => @graphics.camera.moveUp()
key 'a', => @graphics.camera.moveLeft()
key 's', => @graphics.camera.moveDown()
key 'd', => @graphics.camera.moveRight()
gameContext: -> key.setScope('game')
menuContext: -> key.setScope('menu')
tutorialContext: -> key.setScope('tutorial')