diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..266c6e5 --- /dev/null +++ b/css/style.css @@ -0,0 +1,9 @@ +body { + padding-top: 100px; +} + +#Detector img { + border-radius: 10px; + cursor: pointer; + width: 200px; +} diff --git a/index.html b/index.html index 68227c0..c8ae89d 100644 --- a/index.html +++ b/index.html @@ -5,44 +5,67 @@ - + + -
- Your detector. Click on it to generate events. -
+ -
-

HR Department

-
-

{{ w.name }}

-

{{ w.description }} You have {{ w.hired }} of them working for you.

- +
+
+
+ Your detector. Click on it to generate events. +
+ +
+

{{ lc.lab.name }}

+

Data: {{ lc.lab.data }}

+

Reputation: {{ lc.lab.reputation }}

+

Money: {{ lc.lab.money }}

+
+
+ +
+

Research

+
+

{{ r.name }} Level: {{ r.level }}

+

{{ r.description }}

+ +
+
+ +
+

HR Department

+
+

{{ w.name }} ({{ w.hired }})

+

{{ w.description }}

+ +
+
-
diff --git a/js/game.js b/js/game.js index e954577..df8376a 100644 --- a/js/game.js +++ b/js/game.js @@ -1,7 +1,4 @@ 'use strict'; - -var DEBUG = true; - (function () { var loadJsonFile = function(filename) { var res; @@ -53,20 +50,28 @@ var DEBUG = true; var research = loadJsonFile('json/research.json'); research.map(function (item) { // define additional stuff on the objects item.level = 0; + item.is_visible = function () { + return this.level > 0 || lab.data >= this.cost * .9; + }; item.is_available = function () { - return this.level > 0 || lab.data > item.cost * .9; + return lab.data >= this.cost; }; item.research = function () { if (lab.research(this.cost, this.reputation)) { this.level++; } - } + }; }); - if (DEBUG) console.log(research); var workers = loadJsonFile('json/workers.json'); workers.map(function (worker) { worker.hired = 0; + worker.is_visible = function () { + return this.hired > 0 || lab.money >= this.cost * .9; + }; + worker.is_available = function () { + return lab.money >= this.cost; + }; worker.hire = function() { if (lab.buy(this.cost)) { this.hired++; @@ -74,6 +79,7 @@ var DEBUG = true; }; }); + var app = angular.module('particleClicker', []); app.controller('DetectorController', function () {