Merge branch 'master' of https://github.com/arg-games/ld31
BIN
public/images/end.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 820 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2 KiB |
BIN
public/images/intro-mars_03.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
public/images/intro-mars_04.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
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()
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|