From 0bcc7acd2085a91570966d8483195f6fba81a71c Mon Sep 17 00:00:00 2001 From: Aaron Mueller Date: Sun, 7 Dec 2014 18:37:04 +0100 Subject: [PATCH] energy and game end check --- public/images/entities.png | Bin 820 -> 915 bytes public/images/hud.png | Bin 1792 -> 2372 bytes src/entities/base.coffee | 1 + src/entities/miner.coffee | 1 + src/entities/silo.coffee | 1 + src/entities/solarpanel.coffee | 1 + src/game.coffee | 10 ++++++++++ src/hud.coffee | 9 ++++++++- 8 files changed, 22 insertions(+), 1 deletion(-) diff --git a/public/images/entities.png b/public/images/entities.png index 6d018f743ff17932c32b2f79fb9d76cd2595f5c2..956d8f5ee7d969a94781350e3759efb9fad625f5 100644 GIT binary patch delta 862 zcmV-k1EKu129pPnLVpnfG?|PJ^Z)<@GD$>1R9M69md|S(Wf;dl@9cK-W5afaVu-8@ zb-@*(3tdetc<|yu=)pt12$4V~B?nI;LeaZm5B>obvFJkD`gvQp_`NhTI8(Jo2d zBu(0EvOAmXCX2JXGfxlAZf7?pnUYSu_=WfI&gY%?`Ofn`4}bF_A^-wNC=!y>@1&$X z7ZHNyYInkSvzKT&HkFMUo3%~8{NNkB3W}?X*Cr&L$ncW>GJT;TG|^bJ=DGi1nHLko z{INJokX&1uU&X117>Ons(1vKa4*K8=3M z4?JjuM-2nBQlVL`GCeWD%-kHy^*R8fyJ>wIemkGv!w-@Y5tLFgl}xf>+gv?+mQSx= z=j)Y~PJeNFd05x^+%PzO>z0?(<^Wd{2~;lEN%5fu+Ch41qpQe#@IAHVM_TWOqlU3( zbDta!$FJ1WEDk~%|FJah8P}H1NNwqi^q#jLek23s3rb3p5SmF7nn~|l18rWKeEiNc zGjQUvs1ui;1T9}s;tkL{?_GZsb+uu2@l60?Cx55^wG9vAM>g<(7XWCHJ{fv7{ajO` zM1;?Be@erFmN+;fRP81^b(^2xdrJjvAPn&Ch(WQo&4X%_{z!Wu*~YiH2}7(G8=^g)#+bwo6SJ8prWZ$@@w`6b-PJ<=kb4hb+bl8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qkH(QL{_XoidD#rl(oL^WyQz;78_zG+~U z1SXT7O08TQydQ4CPoCF?eFD{i3Q&woj+oCHhB z^oFXXRD!cidUV|qX$DNkdS5z%HN3KQ!1==1*f^IN2{FqSuaxPb)&Nrl|J~~Y0ICDwhKJfLw z^IRDwC)Z3Rn02r5E||!!oPPwn${n0c%SrH|Pk-bld*rA}z*NNHj`qnrA#!!Vc(C_^ z=M%)0%b6n;%EYk~d$9A(MgYL)TWTgVpj;iWpfDQ-qn5iPLZs7dG14M)GA@{8LDD9^ zZ%?;ZJws`NU~rgw=vcN67%#zWoMqB;QafF|X5C_(JAGBQ4f`;HihtBb{3{?rvK2{cnK~lewywZ8XD#9?MlUR5-inTmEiOs-{FpS zjn5+{M?g^waQA8DVwOB|F^lQiTx-7s0C;uNYuH}hfFnoup=!gs>X}qH`AQcp(Xi%& zfO|T%d|7dH|AF0)ZA-%2s~hmy-jC>@~07*qoM6N<$f*VX$^Z)<= diff --git a/src/entities/base.coffee b/src/entities/base.coffee index 142b1d2..4d2e824 100644 --- a/src/entities/base.coffee +++ b/src/entities/base.coffee @@ -22,4 +22,5 @@ class Base @frame += 1 spaceProvided: 300 + energyProvided: 7 isDockable: true diff --git a/src/entities/miner.coffee b/src/entities/miner.coffee index 7757474..b5f010c 100644 --- a/src/entities/miner.coffee +++ b/src/entities/miner.coffee @@ -22,4 +22,5 @@ class Miner @frame += 1 spaceProvided: 5 + energyProvided: 0 isDockable: false diff --git a/src/entities/silo.coffee b/src/entities/silo.coffee index 437d602..36c5274 100644 --- a/src/entities/silo.coffee +++ b/src/entities/silo.coffee @@ -21,6 +21,7 @@ class Silo @frame += 1 spaceProvided: 150 + energyProvided: 0 isDockable: true diff --git a/src/entities/solarpanel.coffee b/src/entities/solarpanel.coffee index f267cf8..8214f1c 100644 --- a/src/entities/solarpanel.coffee +++ b/src/entities/solarpanel.coffee @@ -11,4 +11,5 @@ class Solarpanel false spaceProvided: 0 + energyProvided: 15 isDockable: true diff --git a/src/game.coffee b/src/game.coffee index 2b57577..05069cb 100644 --- a/src/game.coffee +++ b/src/game.coffee @@ -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 diff --git a/src/hud.coffee b/src/hud.coffee index 35d7fcd..b6618cf 100644 --- a/src/hud.coffee +++ b/src/hud.coffee @@ -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()