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 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) -> keyup: (event) ->
switch event.key switch event.key
when "m" then @createMiner() when "m" then @createMiner()
when "e" then @createSolarpanel()
when "i" then app.game.hud.showBuildInfo() when "i" then app.game.hud.showBuildInfo()
when "s" then @createSilo() when "s" then @createSilo()
when "c" then @cheatah() when "c" then @cheatah()
@ -104,9 +105,17 @@ app.game =
@speechbubble.say 'nores' @speechbubble.say 'nores'
else else
@speechbubble.say 'toofar' @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) -> checkResource: (type, amount, drain = false) ->
if @resources[type] >= amount if @resources[type] >= amount
@resources[type] -= amount if drain @resources[type] -= amount if drain

View file

@ -16,7 +16,6 @@ app.game.hud =
render: -> render: ->
panelusage = 'resources' panelusage = 'resources'
app.layer.drawImage app.images.hud, 0, 11*8 app.layer.drawImage app.images.hud, 0, 11*8
if @buildinfo if @buildinfo
@ -29,7 +28,6 @@ app.game.hud =
if currentSelectedTile != null if currentSelectedTile != null
panelusage = 'tile' panelusage = 'tile'
if currentSelectedTile.entity if currentSelectedTile.entity
panelusage = 'entity' panelusage = 'entity'
app.layer.drawRegion app.images.entitydetails, currentSelectedTile.entity.spritedetail(), 12, 95 app.layer.drawRegion app.images.entitydetails, currentSelectedTile.entity.spritedetail(), 12, 95