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 c52dab9d authored by pmdv46's avatar pmdv46

more functionality for pickle upgrade

parent 08fc5cd5
......@@ -8,13 +8,61 @@ import { GamePlayService } from '../game-play.service';
})
export class ClickComponent {
readonly totalClicks = this.service.pickleCount;
//readonly totalClicks = this.service.getPickles();
readonly clickMulti = this.service.incrementsClicksVal;
upgradeLevel = 'assets/Hamburger.png';
upgradeLevel = 'assets/Hamburger.png'
upgradeList = ['assets/Hamburger.png', 'assets/BabyDill.png', 'assets/Spear.png', 'assets/Pickle.png', 'assets/GoldenPickle.png'];
upgradePrices = [1, 5000, 50000, 500000, 5000000];
upgradeCount = 1;
constructor(private service: GamePlayService) {}
constructor(private service: GamePlayService) { }
upgrade() {
this.upgradeLevel = 'assets/BabyDill.png';
if (!(this.service.checkEnough(this.upgradePrices[this.upgradeCount - 1]))) {
this.service.pickleUpgrade(this.upgradePrices[this.upgradeCount]).catch((err) => console.log(err));
// changing next upgrade picture
this.upgradeLevel = this.upgradeList[this.upgradeCount++];
/*
// buying upgrade
this.pickles.next(this.pickles.value - this.upgradePrices[this.upgradeCount]);
// changing next upgrade picture
this.upgradeLevel = this.upgradeList[this.upgradeCount++];
// upgrade taking effect
this.service.pickleUpgrade.catch((err) => console.log(err));
*/
}
/*
while (this.upgradeCount < this.upgradeList.length) {
if (this.totalClicks >= this.upgradePrices[this.upgradeCount]) {
this.service.pickleUpgrade(this.upgradePrices[this.upgradeCount]).catch((err) => console.log(err));
// changing next upgrade picture
this.upgradeLevel = this.upgradeList[this.upgradeCount++];
/*
// buying upgrade
this.pickles.next(this.pickles.value - this.upgradePrices[this.upgradeCount]);
// changing next upgrade picture
this.upgradeLevel = this.upgradeList[this.upgradeCount++];
// upgrade taking effect
this.service.pickleUpgrade.catch((err) => console.log(err));
}
}
*/
}
increment() {
......
......@@ -22,6 +22,26 @@ export class GamePlayService {
this.pickles.next(this.pickles.value + this.incrementsClicks.value);
}
async checkEnough(price) {
if (this.pickleCount >= price) {
return true;
}
return false;
}
/*
async getPickles() {
return this.pickles.value;
}
*/
async pickleUpgrade(cost) {
this.incrementsClicks.next(this.incrementsClicks.value * 10);
// buying upgrade
this.pickles.next(this.pickles.value - cost);
}
async jarUpgrade() {
if (this.pickles.value >= 5) {
this.accumulates.next(this.accumulates.value + 5);
......
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