From c947c4ac08aa2d6fdc671992e0da5f4570ab06d5 Mon Sep 17 00:00:00 2001 From: Aaron Mueller Date: Sat, 6 Dec 2014 09:24:36 +0100 Subject: [PATCH] ... --- public/index.html | 8 +++++++- src/game.coffee | 10 +++++++++- src/main.coffee | 43 ++++++++++++++++++++----------------------- 3 files changed, 36 insertions(+), 25 deletions(-) diff --git a/public/index.html b/public/index.html index 2bdf638..ef99bed 100644 --- a/public/index.html +++ b/public/index.html @@ -7,8 +7,14 @@ - + + diff --git a/src/game.coffee b/src/game.coffee index d976df2..4dd6b96 100644 --- a/src/game.coffee +++ b/src/game.coffee @@ -1,9 +1,17 @@ game = { start: -> + hud: -> + app + .layer + .fillStyle "#00f" + .fillRect 0, 0, 200, 50 + + step: -> + this.hud resources: - ore: 0 + ore: 50 stone: 100 } diff --git a/src/main.coffee b/src/main.coffee index c103045..9873203 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -1,25 +1,22 @@ -$ -> - playground({ - width: 16*20, - height: 16*20, - scaleToFit: true, - smoothing: false, +app = playground({ + width: 16*20, + height: 16*20, + scaleToFit: true, + smoothing: false, + + createTestTiles: -> + testTile1 = new Tile + testTile2 = new Tile - create: -> - # TODO: Load images - - @createTestTiles() - - createTestTiles: -> - testTile1 = new Tile - testTile2 = new Tile - - ready: -> - game.start - this.setState(game) - - step: -> - - render: -> - this.layer.clear("#333"); + create: -> + @createTestTiles() + + ready: -> + game.start + @setState game + + step: -> + + render: -> + this.layer.clear("#000"); })