From c4ba7c582be1720e1217f24129c58c85ebddb019 Mon Sep 17 00:00:00 2001 From: Aaron Mueller Date: Sat, 6 Dec 2014 21:36:19 +0100 Subject: [PATCH] Refactor the folder structure --- gulpfile.js | 2 +- src/{main.coffee => app.coffee} | 0 src/entities/base_entity.coffee | 3 --- src/entities/miner.coffee | 2 +- src/{entities => tiles}/tile.coffee | 6 ++---- src/{entities => tiles}/tilelayer.coffee | 2 +- 6 files changed, 5 insertions(+), 10 deletions(-) rename src/{main.coffee => app.coffee} (100%) delete mode 100644 src/entities/base_entity.coffee rename src/{entities => tiles}/tile.coffee (95%) rename src/{entities => tiles}/tilelayer.coffee (86%) diff --git a/gulpfile.js b/gulpfile.js index 57580f0..ce41c01 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -21,7 +21,7 @@ gulp.task('server', function() { }); gulp.task('compile', function() { - return gulp.src(['src/entities/*.coffee', 'src/tools.coffee', 'src/main.coffee', 'src/game.coffee', 'src/hud.coffee']) + return gulp.src(['src/entities/*.coffee', 'src/tiles/*.coffee', 'src/tools.coffee', 'src/app.coffee', 'src/game.coffee', 'src/hud.coffee']) .pipe(sourcemaps.init()) .pipe(coffee({bare: true})) .pipe(concat('app.js')) diff --git a/src/main.coffee b/src/app.coffee similarity index 100% rename from src/main.coffee rename to src/app.coffee diff --git a/src/entities/base_entity.coffee b/src/entities/base_entity.coffee deleted file mode 100644 index 1ce1d82..0000000 --- a/src/entities/base_entity.coffee +++ /dev/null @@ -1,3 +0,0 @@ -class BaseEntity - constructor: (options) -> - {} = options diff --git a/src/entities/miner.coffee b/src/entities/miner.coffee index 8b817d7..8bd3b2d 100644 --- a/src/entities/miner.coffee +++ b/src/entities/miner.coffee @@ -1,3 +1,3 @@ -class Miner extends BaseEntity +class Miner tick: (tile) -> tile.click "left" diff --git a/src/entities/tile.coffee b/src/tiles/tile.coffee similarity index 95% rename from src/entities/tile.coffee rename to src/tiles/tile.coffee index 753f7b2..ce9a8f5 100644 --- a/src/entities/tile.coffee +++ b/src/tiles/tile.coffee @@ -1,7 +1,5 @@ -class Tile extends BaseEntity - constructor: (options) -> - super options - +class Tile + constructor: -> resTypes = (k for own k of app.game.resources) @layers = [] diff --git a/src/entities/tilelayer.coffee b/src/tiles/tilelayer.coffee similarity index 86% rename from src/entities/tilelayer.coffee rename to src/tiles/tilelayer.coffee index a22da6c..3882592 100644 --- a/src/entities/tilelayer.coffee +++ b/src/tiles/tilelayer.coffee @@ -1,4 +1,4 @@ -class Tilelayer extends BaseEntity +class Tilelayer constructor: (options)-> {@type, @depth, @amount} = options @randomFactor = getRandomInt 0, 4