This server is intended for use for Academic Classwork related Git repositories only. Projects/repositories will generally be removed after 6 months following close of the semester. Inactive repositories from previous semester are now being archived when no activity for 365 days. They are renamed and marked as 'archived'. After 90 days in that state they will be removed from the system completely.

Commit 1e8f6822 authored by Pamela Petterchak's avatar Pamela Petterchak

update

parent 99e49c6d
......@@ -30,7 +30,8 @@
"styles": [
"src/styles.scss"
],
"scripts": []
"scripts": [],
"webWorkerTsConfig": "tsconfig.worker.json"
},
"configurations": {
"production": {
......@@ -103,7 +104,8 @@
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
"e2e/tsconfig.json",
"tsconfig.worker.json"
],
"exclude": [
"**/node_modules/**"
......
<script>
accumulate();
</script>
<button mat-raised-button>
<img src="assets/PickleJar.png" (click)="jarUpgrade()" />
</button>
......@@ -14,6 +18,6 @@
<img src="assets/Reservoir.png" (click)="reservoirUpgrade()" />
</button>
<h4>multiplier: {{ clickMulti }}</h4>
<h4>multiplier: {{ accumulatesMulti | async }}</h4>
<!-- Add more buttons for upgrades here, with their own functions -->
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { GamePlayService } from '../game-play.service';
@Component({
......@@ -9,10 +9,13 @@ import { GamePlayService } from '../game-play.service';
export class AccumulatorsComponent {
// Not correct yet - need to figure out how to communicate btw click and accumulator
readonly totalClicks = this.service.pickleCount;
readonly clickMulti = this.service.incrementVal;
readonly clickMulti = this.service.incrementsClicksVal;
readonly accumulatesMulti = this.service.accumulatesVal;
constructor(private service: GamePlayService) { }
intervalID = window.setInterval(() => this.service.accumulate(), 1000);
jarUpgrade() {
this.service.jarUpgrade().catch((err) => console.log(err));
}
......
import { style } from '@angular/animations';
import { Component } from '@angular/core';
import { GamePlayService } from '../game-play.service';
......@@ -9,10 +8,10 @@ import { GamePlayService } from '../game-play.service';
})
export class ClickComponent {
readonly totalClicks = this.service.pickleCount;
readonly clickMulti = this.service.incrementVal;
readonly clickMulti = this.service.incrementsClicksVal;
upgradeLevel = 'assets/Hamburger.png';
constructor(private service: GamePlayService) { }
constructor(private service: GamePlayService) {}
upgrade() {
this.upgradeLevel = 'assets/BabyDill.png';
......
<!-- Need to create two columns - one with assets, one with cookie clicker stuff -->
<div class="row">
<div class="column">
<mat-card class="title">
......
......@@ -10,34 +10,52 @@ export class GamePlayService {
private readonly pickles = new BehaviorSubject<number>(0);
readonly pickleCount = this.pickles.asObservable();
private readonly increments = new BehaviorSubject<number>(1);
readonly incrementVal = this.increments.asObservable();
private readonly incrementsClicks = new BehaviorSubject<number>(1);
readonly incrementsClicksVal = this.incrementsClicks.asObservable();
private readonly accumulates = new BehaviorSubject<number>(0);
readonly accumulatesVal = this.accumulates.asObservable();
constructor() {
console.log('Game service activated');
}
async increment() {
this.pickles.next(this.pickles.value + this.increments.value);
this.pickles.next(this.pickles.value + this.incrementsClicks.value);
}
async jarUpgrade() {
this.increments.next(this.increments.value + 5);
this.pickles.next(this.pickles.value - 5);
if (this.pickles.value >= 5) {
this.accumulates.next(this.accumulates.value + 5);
this.pickles.next(this.pickles.value - 5);
}
// need to add else to throw error
}
async barrelUpgrade() {
this.increments.next(this.increments.value + 50);
this.pickles.next(this.pickles.value - 50);
if (this.pickles.value >= 50) {
this.accumulates.next(this.accumulates.value + 50);
this.pickles.next(this.pickles.value - 50);
}
}
async siloUpgrade() {
this.increments.next(this.increments.value + 500);
this.pickles.next(this.pickles.value - 500);
if (this.pickles.value >= 500) {
this.accumulates.next(this.accumulates.value + 500);
this.pickles.next(this.pickles.value - 500);
}
}
async reservoirUpgrade() {
this.increments.next(this.increments.value + 5000);
this.pickles.next(this.pickles.value - 500);
if (this.pickles.value >= 5000) {
this.accumulates.next(this.accumulates.value + 5000);
this.pickles.next(this.pickles.value - 5000);
}
}
accumulate() {
while (this.pickles.value < 100000000) {
this.pickles.next(this.pickles.value + this.accumulates.value);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment