Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
db62c5d9a2
5 changed files with 25 additions and 4 deletions
Binary file not shown.
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 820 B |
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2 KiB |
14
src/entities/solarpanel.coffee
Normal file
14
src/entities/solarpanel.coffee
Normal file
|
@ -0,0 +1,14 @@
|
|||
class Solarpanel
|
||||
tick: (tile)->
|
||||
|
||||
sprite: ->
|
||||
[0, 8*3, 8, 8]
|
||||
|
||||
spritedetail: ->
|
||||
[0, 16*3, 16, 16]
|
||||
|
||||
isMoveable: ->
|
||||
false
|
||||
|
||||
spaceProvided: 0
|
||||
isDockable: true
|
|
@ -64,6 +64,7 @@ app.game =
|
|||
keyup: (event) ->
|
||||
switch event.key
|
||||
when "m" then @createMiner()
|
||||
when "e" then @createSolarpanel()
|
||||
when "i" then app.game.hud.showBuildInfo()
|
||||
when "s" then @createSilo()
|
||||
when "c" then @cheatah()
|
||||
|
@ -92,9 +93,17 @@ app.game =
|
|||
@speechbubble.say 'nores'
|
||||
else
|
||||
@speechbubble.say 'toofar'
|
||||
else
|
||||
@speechbubble.say 'nosel'
|
||||
|
||||
# TODO: OMG refactor this ...
|
||||
createSolarpanel: ->
|
||||
if @currentSelectedTile
|
||||
if @checkPosition(@currentSelectedTile)
|
||||
if @checkResource('notch', 10, true)
|
||||
@currentSelectedTile.entity = new Solarpanel
|
||||
else
|
||||
@speechbubble.say 'nores'
|
||||
else
|
||||
@speechbubble.say 'toofar'
|
||||
checkResource: (type, amount, drain = false) ->
|
||||
if @resources[type] >= amount
|
||||
@resources[type] -= amount if drain
|
||||
|
|
|
@ -16,7 +16,6 @@ app.game.hud =
|
|||
|
||||
render: ->
|
||||
panelusage = 'resources'
|
||||
|
||||
app.layer.drawImage app.images.hud, 0, 11*8
|
||||
|
||||
if @buildinfo
|
||||
|
@ -28,7 +27,6 @@ app.game.hud =
|
|||
if currentSelectedTile != null
|
||||
panelusage = 'tile'
|
||||
|
||||
|
||||
if currentSelectedTile.entity
|
||||
panelusage = 'entity'
|
||||
app.layer.drawRegion app.images.entitydetails, currentSelectedTile.entity.spritedetail(), 12, 95
|
||||
|
|
Loading…
Reference in a new issue