energy and game end check

This commit is contained in:
Aaron Mueller 2014-12-07 18:37:04 +01:00
parent 48ee574185
commit 0bcc7acd20
8 changed files with 22 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -22,4 +22,5 @@ class Base
@frame += 1
spaceProvided: 300
energyProvided: 7
isDockable: true

View file

@ -22,4 +22,5 @@ class Miner
@frame += 1
spaceProvided: 5
energyProvided: 0
isDockable: false

View file

@ -21,6 +21,7 @@ class Silo
@frame += 1
spaceProvided: 150
energyProvided: 0
isDockable: true

View file

@ -11,4 +11,5 @@ class Solarpanel
false
spaceProvided: 0
energyProvided: 15
isDockable: true

View file

@ -174,6 +174,16 @@ app.game =
space += amount for resource, amount of @resources
space
solarpanelCount: ->
energy = 0
for tile in app.game.map
energy += 1 if tile.entity and tile.entity.energyProvided > 10
energy
gameEndCheck: ->
return true if @solarpanelCount() >= 4
false
resources:
stardust: 0
dirt: 0

View file

@ -48,9 +48,16 @@ app.game.hud =
x = 44+f
y = 112
app.layer.setPixel(resourcePanelColor, x, y)
# Energy production (47)
length = Math.round(((25*app.game.solarpanelCount())*4)/100)
for i in [0..length]
app.layer.setPixel("#228ca5", 49+i, 91)
app.layer.setPixel("#8ddaed", 50+i, 92)
app.layer.setPixel("#228ca5", 49+i, 93)
switch panelusage
when 'tile'
@showResources()