Add infobox
This commit is contained in:
parent
dc46a06ee0
commit
f02df022d3
3 changed files with 16 additions and 1 deletions
|
@ -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: ->
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue