Show resources
This commit is contained in:
parent
2a9deedee7
commit
0fd3f60aeb
3 changed files with 15 additions and 8 deletions
|
@ -4,8 +4,10 @@ app.game =
|
||||||
@map[i] = new Tile
|
@map[i] = new Tile
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
|
app.layer.save().scale(5, 5)
|
||||||
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))
|
||||||
|
app.layer.restore()
|
||||||
@hud.render()
|
@hud.render()
|
||||||
|
|
||||||
step: ->
|
step: ->
|
||||||
|
@ -13,8 +15,8 @@ app.game =
|
||||||
map: []
|
map: []
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
stardust: 0
|
stardust: 10
|
||||||
bedrock: 0
|
bedrock: 1
|
||||||
lubinit: 0
|
lubinit: 0
|
||||||
oxodum: 0
|
oxodum: 0
|
||||||
notch: 0
|
notch: 0
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
app.game.hud =
|
app.game.hud =
|
||||||
render: ->
|
render: ->
|
||||||
app.layer
|
posy = 20
|
||||||
.fillStyle "#f00"
|
for type, amount of app.game.resources
|
||||||
.fillRect 0, 0, 8, 8
|
if amount > 0
|
||||||
|
app.layer
|
||||||
|
.fillStyle "#fff"
|
||||||
|
.font "15px Arial"
|
||||||
|
.wrappedText(amount + "x " + type, 10, posy, 200)
|
||||||
|
posy += 15
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
app = playground({
|
app = playground({
|
||||||
width: 8*20,
|
width: 8*20*5,
|
||||||
height: 8*15,
|
height: 8*15*5,
|
||||||
scaleToFit: true,
|
scaleToFit: false,
|
||||||
smoothing: false,
|
smoothing: false,
|
||||||
|
|
||||||
create: ->
|
create: ->
|
||||||
|
|
Loading…
Reference in a new issue