Skip to content

Commit

Permalink
Store Updated!
Browse files Browse the repository at this point in the history
The store now shows the amount of strawberries, as well as only showing the amount you have of somthing when that plot is unlocked!
  • Loading branch information
Squirrel-314 committed Jan 4, 2021
1 parent f1ca661 commit 916663f
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Game/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
</div>
<div id="information">
<h1>Produce</h1>
<div class="">
<div class="produce">
<p id="peaBushels">0 Bushels of Peas</p>
<p id="cornBushels">0 Bushels of Corn</p>
<p id="strawberryBushels">0 Bushels of Strawberries</p>
</div>
<button onclick="restart()">Restart</button>
</div>
Expand Down
31 changes: 27 additions & 4 deletions Game/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,27 @@
~~~~~~~~~~~~~~~~~
TABLE OF CONTENTS
~~~~~~~~~~~~~~~~~
Idea | Thoughts, plots, the lot
Game Data | All game information stored in object variables
Peas | All about the first plot
Store | Update the store
Purchase Plots | Functiona that unlock plots
Purchase Plots | Functions that unlock plots
Setup | Prepare game for returning player
Settings | So far, just restart
Save | Save the game data
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Initate JavaScript strict mode
"use strict";

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ideas
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
//Automate harvesting while active
if (poltStatus.peas = "ready") {
document.getElementById("harvest1").click();
}
*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Game Data
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
Expand Down Expand Up @@ -189,7 +199,7 @@ function harvestStrawberries() {

function strawberriesStatus() {
if (plotStatus.strawberries === "fruiting") {
document.getElementById("plot3").style.background = "url(../Images/fruiting-strawberry-plant.png)";
document.getElementById("plot3").style.background = "url(../Images/Plots/grown-strawberries.png)";
document.getElementById("plot3").style.backgroundSize = "cover";
document.getElementById("harvest3").style.opacity = "1";
document.getElementById("harvest3").style.zIndex = "1";
Expand Down Expand Up @@ -271,8 +281,21 @@ function removeStrawberryLock() {

function produceDisplay() {
// Updates the amount of produce in store
document.getElementById("peaBushels").innerHTML = `${produce.peas} Bushels of Peas`
document.getElementById("cornBushels").innerHTML = `${produce.corn} Bushels of Corn`
// If the plot is unlocked
if (plots.peaplot === "unlocked") {
// Show the element
document.getElementById("peaBushels").style.visibility = "visible";
// Display the amount of that product
document.getElementById("peaBushels").innerHTML = `${produce.peas} Bushels of Peas`;
}
if (plots.cornplot === "unlocked") {
document.getElementById("cornBushels").style.visibility = "visible";
document.getElementById("cornBushels").innerHTML = `${produce.corn} Bushels of Corn`;
}
if (plots.strawberryplot === "unlocked") {
document.getElementById("strawberryBushels").style.visibility = "visible";
document.getElementById("strawberryBushels").innerHTML = `${produce.strawberries} Bushels of Strawberries`;
}
}

var plantStatus = window.setInterval(function() {
Expand Down
9 changes: 7 additions & 2 deletions Game/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,20 @@ body {

#grow1, #grow2, #grow3 {
transition: .2s;
border-radius: 1px;
border-radius: 2px;
position: absolute;
z-index: 1;
border: solid 2px black;
}

.locked {
height: 130px;
}

.produce p {
visibility: hidden;
}

.remaining-crop-time {
border: solid 2px #fff;
border-radius: 5px;
Expand All @@ -80,7 +85,7 @@ body {

#harvest1, #harvest2, #harvest3 {
transition: .2s;
border-radius: 1px;
border-radius: 2px;
opacity: 0;
z-index: -1;
}
Expand Down
Binary file modified Images/Plots/grown-strawberries.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added Images/Vegetables/strawberry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file removed Images/strawberry.png
Binary file not shown.
Binary file modified Images/young-tree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 916663f

Please sign in to comment.