diff --git a/public/images/entities.png b/public/images/entities.png index ce5715e..6d018f7 100644 Binary files a/public/images/entities.png and b/public/images/entities.png differ diff --git a/public/images/entitydetails.png b/public/images/entitydetails.png index 51e86d8..4e99078 100644 Binary files a/public/images/entitydetails.png and b/public/images/entitydetails.png differ diff --git a/src/entities/solarpanel.coffee b/src/entities/solarpanel.coffee new file mode 100644 index 0000000..f267cf8 --- /dev/null +++ b/src/entities/solarpanel.coffee @@ -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 diff --git a/src/game.coffee b/src/game.coffee index 921da74..b2938a1 100644 --- a/src/game.coffee +++ b/src/game.coffee @@ -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 diff --git a/src/hud.coffee b/src/hud.coffee index 5df8b50..6a4575d 100644 --- a/src/hud.coffee +++ b/src/hud.coffee @@ -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