This commit is contained in:
Aaron Mueller 2014-12-06 19:01:21 +01:00
parent 8adc7d0002
commit ecfa9d7268
7 changed files with 7 additions and 9 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
node_modules node_modules
public/app.js public/app.js
.Thumbs.db

Binary file not shown.

Before

Width:  |  Height:  |  Size: 890 B

Binary file not shown.

BIN
public/images/hud.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 B

View file

@ -9,15 +9,11 @@ app.game =
@currentSelectedTile = new Tile @currentSelectedTile = new Tile
render: -> render: ->
app.layer.save().scale(5, 5)
for tile, i in @map for tile, i in @map
y = Math.floor(i/20) y = Math.floor(i/20)
x = i-(y*20) x = i-(y*20)
tile.render(x, y) tile.render(x, y)
app.layer.restore()
@hud.render() @hud.render()
step: -> step: ->
@ -53,7 +49,7 @@ app.game =
@currentSelectedTile.attachMiner newMiner @currentSelectedTile.attachMiner newMiner
posToTile: (x, y)-> posToTile: (x, y)->
pos = (Math.floor(y/8/5)*20) + Math.floor(x/8/5) pos = (Math.floor(y/8)*20) + Math.floor(x/8)
@map[pos] @map[pos]
map: [] map: []

View file

@ -1,5 +1,6 @@
app.game.hud = app.game.hud =
render: -> render: ->
app.layer.drawImage app.images.hud, 0, 12*8+2
posy = 49 posy = 49
for type, amount of app.game.resources for type, amount of app.game.resources
if amount > 0 if amount > 0

View file

@ -1,11 +1,11 @@
app = playground( app = playground(
width: 8*20*5, width: 8*20,
height: 8*15*5, height: 8*15,
scaleToFit: true, scaleToFit: true,
smoothing: false, smoothing: false,
create: -> create: ->
@loadImages "layers", "active", "selected", "entities" @loadImages "layers", "active", "selected", "entities", "hud"
@currentHoveredTile = new Tile @currentHoveredTile = new Tile
ready: -> ready: ->