Start implementing the HUD

This commit is contained in:
Aaron Mueller 2014-12-06 12:55:43 +01:00
parent 5bda68d44a
commit f5b3c0a91f
3 changed files with 9 additions and 8 deletions

View file

@ -21,7 +21,7 @@ gulp.task('server', function() {
}); });
gulp.task('compile', function() { gulp.task('compile', function() {
return gulp.src(['src/entities/*.coffee', 'src/main.coffee', 'src/game.coffee']) return gulp.src(['src/entities/*.coffee', 'src/main.coffee', 'src/game.coffee', 'src/hud.coffee'])
.pipe(sourcemaps.init()) .pipe(sourcemaps.init())
.pipe(coffee({bare: true})) .pipe(coffee({bare: true}))
.pipe(concat('app.js')) .pipe(concat('app.js'))

View file

@ -3,20 +3,15 @@ app.game =
for i in [0..20*15] for i in [0..20*15]
@map[i] = new Tile @map[i] = new Tile
hud: ->
app.layer
.fillStyle "#00f"
.fillRect 0, 0, 200, 50
render: -> render: ->
for tile, i in @map for tile, i in @map
tile.render(i-(Math.floor(i/20)*20), Math.floor(i/20)) tile.render(i-(Math.floor(i/20)*20), Math.floor(i/20))
@hud.render()
step: -> step: ->
@hud
map: [] map: []
resources: resources:
ore:50 ore:60
stone: 100 stone: 100

6
src/hud.coffee Normal file
View file

@ -0,0 +1,6 @@
app.game.hud =
render: (layer)->
app.layer
.fillStyle "#f00"
.fillRect 0, 0, 8, 8