qgame

by kevmus

HTML

<body ng-app="incremental">
  <div ng-controller="IncCtrl">
    {{cookies}}
  </div>
</body>

CSS

</style> <!DOCTYPE html> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous" <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> <meta name='viewport' content='initial-scale=1.0, width=device-width' />



<style type="text/css">

JavaScript

angular.module('incremental',[])
    .controller('IncCtrl',['$scope','$document','$interval',function($scope,$document,$interval) {
        
        $scope.cookies = 0;
        
        $scope.clickers = 0;
        
        $scope.click = function() {
            $scope.cookies++;
        }
        
        $scope.clickerPrice = function(){
            return (10 * Math.pow(1.1,$scope.clickers)).toFixed();
        }
        
        $scope.buyClicker = function() {
            if ($scope.cookies >= $scope.clickerPrice()) {
                $scope.cookies -= $scope.clickerPrice();
                $scope.clickers++;
            }
        }
        
        function update() {
            $scope.cookies += $scope.clickers;
        };
        
        $document.ready(function(){
            $interval(update,1000);
        });
    }]);
 /* eslint
  "for-direction": 0,
  "no-await-in-loop": 0,
  "no-compare-neg-zero": 2,
  "no-cond-assign": 0,
  "no-constant-condition": 2,
  "no-control-regex": 2,
  "no-debugger": 2,
  "no-dupe-args": 2,
  "no-dupe-keys": 2,
  "no-duplicate-case": 2,
  "no-empty": 2,
  "no-empty-character-class": 2,
  "no-ex-assign": 2,
  "no-extra-boolean-cast": 2,
  "no-extra-parens": 0,
  "no-extra-semi": 2,
  "no-func-assign": 2,
  "no-inner-declarations": 2,
  "no-invalid-regexp": 2,
  "no-irregular-whitespace": 2,
  "no-obj-calls": 2,
  "no-prototype-builtins": 0,
  "no-regex-spaces": 2,
  "no-sparse-arrays": 2,
  "no-template-curly-in-string": 0,
  "no-unexpected-multiline": 2,
  "no-unreachable": 2,
  "no-unsafe-finally": 2,
  "no-unsafe-negation": 0,
  "use-isnan": 2,
  "valid-typeof": 2,
  "accessor-pairs": 0,
  "array-callback-return": 0,
  "block-scoped-var": 0,
  "class-methods-use-this": 0,
  "complexity": 0,
  "consistent-return": 0,
  "curly": [2, "multi-line"],
  "default-case": 0,
  "dot-location": 0,
  "dot-notation": 0,
  "eqeqeq": 0,
  "guard-for-in": 2,
  "no-alert": 0,
  "no-caller": 2,
  "no-case-declarations": 2,
 ...