diff --git a/src/app.coffee b/src/app.coffee index 56660d6..8ddd661 100644 --- a/src/app.coffee +++ b/src/app.coffee @@ -5,7 +5,7 @@ app = playground( smoothing: false, create: -> - @loadImages "layers", "active", "progress", "selected", "entities", "hud", "actions", "speechbubbles", "deadtiles", "layerdetails", "entitydetails" + @loadImages "layers", "active", "progress", "selected", "entities", "hud", "actions", "speechbubbles", "deadtiles", "layerdetails", "entitydetails", "buildinfo" @currentHoveredTile = new Tile ready: -> diff --git a/src/game.coffee b/src/game.coffee index 23d7343..af98713 100644 --- a/src/game.coffee +++ b/src/game.coffee @@ -64,6 +64,7 @@ app.game = keyup: (event) -> switch event.key when "m" then @createMiner() + when "i" then app.game.hud.showBuildInfo() when "s" then @createSilo() when "c" then @cheatah() when "space" diff --git a/src/hud.coffee b/src/hud.coffee index cc521ab..61a9b5b 100644 --- a/src/hud.coffee +++ b/src/hud.coffee @@ -3,6 +3,7 @@ app.game.hud = resTypes = (k for own k of app.game.resources) @position = x: 45, y: 103 + @buildinfo = false @itemArrow = new AnimatedItem maxFrames: 10, image: app.images.actions, speed: 50 @@ -18,6 +19,11 @@ app.game.hud = app.layer.drawImage app.images.hud, 0, 11*8 + if @buildinfo + app.layer.drawRegion app.images.buildinfo, [0, 0, 106, 10], 1, 1 + app.layer.drawRegion app.images.buildinfo, [0, 10, 106, 10], 1, 12 + app.layer.drawRegion app.images.buildinfo, [0, 20, 106, 10], 1, 23 + currentSelectedTile = app.game.currentSelectedTile if currentSelectedTile != null panelusage = 'tile' @@ -53,6 +59,14 @@ app.game.hud = when 'resources' @showResources() + showBuildInfo: -> + clearTimeout(@timeout) if @timeout + @buildinfo = true + @timeout = window.setTimeout @hideBuildInfo, 2000 + + hideBuildInfo: -> + app.game.hud.buildinfo = false + showResources: -> # resources i = 0