diff --git a/gulpfile.js b/gulpfile.js index 879479a..bfe3d2e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -21,10 +21,9 @@ gulp.task('server', function() { }); gulp.task('compile', function() { - return gulp.src(['src/**/*.coffee']) + return gulp.src(['src/entities/*.coffee', 'src/main.coffee', 'src/game.coffee']) .pipe(sourcemaps.init()) .pipe(coffee({bare: true})) - .pipe(uglify()) .pipe(concat('app.js')) .pipe(sourcemaps.write()) .pipe(gulp.dest('public')); diff --git a/src/entities/tile.coffee b/src/entities/tile.coffee index fed7472..f44eea5 100644 --- a/src/entities/tile.coffee +++ b/src/entities/tile.coffee @@ -10,10 +10,8 @@ class Tile extends Base_entity new Tilelayer type: 'gold' ] - console.log @layers - tick: (delta) -> # TODO: digging deeper? render: -> - app.layer.fillStyle("#fff").fillRect(0, 0, 8, 8); \ No newline at end of file + app.layer.fillStyle("#fff").fillRect(0, 0, 8, 8); diff --git a/src/game.coffee b/src/game.coffee index 4dd6b96..6fdaa35 100644 --- a/src/game.coffee +++ b/src/game.coffee @@ -1,15 +1,21 @@ -game = { +app.game = { start: -> + for i in [0..20*15] + @map[i] = new Tile hud: -> - app - .layer + app.layer .fillStyle "#00f" .fillRect 0, 0, 200, 50 + render: -> + for i in @map + i.render() step: -> - this.hud + @hud + + map: [] resources: ore: 50 diff --git a/src/main.coffee b/src/main.coffee index ab446e1..7ff68bf 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -1,25 +1,19 @@ app = playground({ - width: 16*20, - height: 16*20, + width: 8*20, + height: 8*15, scaleToFit: true, smoothing: false, - createTestTiles: -> - @testTile1 = new Tile - @testTile2 = new Tile - create: -> - @createTestTiles() ready: -> - game.start - @setState game + @game.start() + @setState @game step: -> - + render: -> - this.layer.clear("#000"); - - @testTile1.render() - @testTile2.render() + @layer.clear("#00f"); + @game.render + })