energy and game end check
This commit is contained in:
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 |
|
@ -22,4 +22,5 @@ class Base
|
||||||
@frame += 1
|
@frame += 1
|
||||||
|
|
||||||
spaceProvided: 300
|
spaceProvided: 300
|
||||||
|
energyProvided: 7
|
||||||
isDockable: true
|
isDockable: true
|
||||||
|
|
|
@ -22,4 +22,5 @@ class Miner
|
||||||
@frame += 1
|
@frame += 1
|
||||||
|
|
||||||
spaceProvided: 5
|
spaceProvided: 5
|
||||||
|
energyProvided: 0
|
||||||
isDockable: false
|
isDockable: false
|
||||||
|
|
|
@ -21,6 +21,7 @@ class Silo
|
||||||
@frame += 1
|
@frame += 1
|
||||||
|
|
||||||
spaceProvided: 150
|
spaceProvided: 150
|
||||||
|
energyProvided: 0
|
||||||
|
|
||||||
isDockable: true
|
isDockable: true
|
||||||
|
|
||||||
|
|
|
@ -11,4 +11,5 @@ class Solarpanel
|
||||||
false
|
false
|
||||||
|
|
||||||
spaceProvided: 0
|
spaceProvided: 0
|
||||||
|
energyProvided: 15
|
||||||
isDockable: true
|
isDockable: true
|
||||||
|
|
|
@ -174,6 +174,16 @@ app.game =
|
||||||
space += amount for resource, amount of @resources
|
space += amount for resource, amount of @resources
|
||||||
space
|
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:
|
resources:
|
||||||
stardust: 0
|
stardust: 0
|
||||||
dirt: 0
|
dirt: 0
|
||||||
|
|
|
@ -48,9 +48,16 @@ app.game.hud =
|
||||||
|
|
||||||
x = 44+f
|
x = 44+f
|
||||||
y = 112
|
y = 112
|
||||||
|
|
||||||
app.layer.setPixel(resourcePanelColor, x, y)
|
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
|
switch panelusage
|
||||||
when 'tile'
|
when 'tile'
|
||||||
@showResources()
|
@showResources()
|
||||||
|
|
Loading…
Reference in a new issue