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