This commit is contained in:
Ruben Müller 2014-12-07 17:57:41 +01:00
commit 7cb6e07602
9 changed files with 25 additions and 4 deletions

Binary file not shown.

BIN
public/images/end.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

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.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View 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

View File

@ -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()
@ -104,9 +105,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

View File

@ -16,7 +16,6 @@ app.game.hud =
render: ->
panelusage = 'resources'
app.layer.drawImage app.images.hud, 0, 11*8
if @buildinfo
@ -29,7 +28,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