hud work
This commit is contained in:
parent
8adc7d0002
commit
ecfa9d7268
7 changed files with 7 additions and 9 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
node_modules
|
||||
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
BIN
public/images/hud.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 867 B |
|
@ -9,15 +9,11 @@ app.game =
|
|||
@currentSelectedTile = new Tile
|
||||
|
||||
render: ->
|
||||
app.layer.save().scale(5, 5)
|
||||
|
||||
for tile, i in @map
|
||||
y = Math.floor(i/20)
|
||||
x = i-(y*20)
|
||||
tile.render(x, y)
|
||||
|
||||
app.layer.restore()
|
||||
|
||||
@hud.render()
|
||||
|
||||
step: ->
|
||||
|
@ -53,7 +49,7 @@ app.game =
|
|||
@currentSelectedTile.attachMiner newMiner
|
||||
|
||||
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: []
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
app.game.hud =
|
||||
render: ->
|
||||
app.layer.drawImage app.images.hud, 0, 12*8+2
|
||||
posy = 49
|
||||
for type, amount of app.game.resources
|
||||
if amount > 0
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
app = playground(
|
||||
width: 8*20*5,
|
||||
height: 8*15*5,
|
||||
width: 8*20,
|
||||
height: 8*15,
|
||||
scaleToFit: true,
|
||||
smoothing: false,
|
||||
|
||||
create: ->
|
||||
@loadImages "layers", "active", "selected", "entities"
|
||||
@loadImages "layers", "active", "selected", "entities", "hud"
|
||||
@currentHoveredTile = new Tile
|
||||
|
||||
ready: ->
|
||||
|
|
Loading…
Reference in a new issue