Skip to content

Commit

Permalink
Fixed a lot of bugs/New Features
Browse files Browse the repository at this point in the history
  • Loading branch information
vassdeniss committed Jan 22, 2021
1 parent f446309 commit 9d92358
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 56 deletions.
26 changes: 17 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en-us">

<head>

Expand All @@ -9,6 +9,7 @@
<link rel="stylesheet" href="main.css">
<link rel="shortcut icon" type="image/png" href="imgaes/icon.png">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<meta name="viewpoint" content="width=device-width, initial-scale=1.0">

</head>

Expand All @@ -20,7 +21,7 @@ <h1 style="text-align: center;"> Pizza Clicker </h1>
<div style="display: block; overflow: hidden;">
<div class="main">

<p id="name"> Your Restaurant </p>
<p id="name"> </p>
<p id="pizzaCounter"> Pizzas: 0 </p>
<p id="cps"> Clicks Per Second: 0.00 </p>

Expand Down Expand Up @@ -68,21 +69,21 @@ <h1 style="text-align: center;"> Pizza Clicker </h1>
</tr>
<tr>
<td class="border"> Pointer Cookers </td>
<td class="border"><span id="clickersPrice"> Price: 15 </span></td>
<td class="border"><img src="imgaes/transparentPizza.png" height="25px" width="25px"><span id="clickersPrice">Price: 15 </span></td>
<td class="border"><span id="clickerCount"> Count: 0 </span></td>
<td class="border"> Increases clicks by 0.1 </td>
<td class="border"><button style="cursor: pointer;" onmousedown="playButtonSound()" onclick="clickersAdder()" id="clickersButton"> Buy </button></td>
</tr>
<tr id="ovens" style="display: none;">
<td class="border"> Ovens </td>
<td class="border"><span id="ovensPrice"> Price: 100 </span></td>
<td class="border"><img src="imgaes/transparentPizza.png" height="25px" width="25px"><span id="ovensPrice">Price: 100 </span></td>
<td class="border"><span id="ovensCount"> Count: 0 </span></td>
<td class="border"> Increases clicks by 1 </td>
<td class="border"><button style="cursor: pointer;" onmousedown="playButtonSound()" onclick="ovensAdder()" id="ovensButton"> Buy </button></td>
</tr>
<tr id="chefs" style="display: none;">
<td class="border"> Chefs </td>
<td class="border"><span id="chefsPrice"> Price: 1100 </span></td>
<td class="border"><img src="imgaes/transparentPizza.png" height="25px" width="25px"><span id="chefsPrice">Price: 1100 </span></td>
<td class="border"><span id="chefsCount"> Count: 0 </span></td>
<td class="border"> Increases clicks by 8 </td>
<td class="border"><button style="cursor: pointer;" onmousedown="playButtonSound()" onclick="chefsAdder()" id="chefsButton"> Buy </button> </td>
Expand All @@ -101,22 +102,28 @@ <h1 style="text-align: center;"> Pizza Clicker </h1>

<p> Upgrades: </p>

<table id="tabl2e">
<table id="table2">
<tr>
<th class="border"> Upgrade </th>
<th class="border"> Cost </th>
<th class="border"> Effect </th>
</tr>
<tr id="GPC" style="display: none;">
<td class="border"> Graduated Pointer Cookers </td>
<td class="border"> Price: 100 </td>
<td class="border"><img src="imgaes/transparentPizza.png" height="25px" width="25px"> Price: 100 </td>
<td class="border"> Clicking and the Pointer Cookers are twice as powerful - <i> "They graduated cooking collage to work for you" </i> </td>
<td><button style="cursor: pointer;" onmousedown="playButtonSound()" id="graduateButton" onclick="graduateAdder()"> Buy </button></td>
</tr>
<tr id="HPC" style="display: none;">
<td class="border"> Heated Pointer Cookers </td>
<td class="border"><img src="imgaes/transparentPizza.png" height="25px" width="25px"> Price: 10000 </td>
<td class="border"> Clicking and the Pointer Cookers are twice as powerful - <i> "Extra heat for faster cooking times" </i> </td>
<td><button style="cursor: pointer;" onmousedown="playButtonSound()" id="hotButton" onclick="hotAdder()"> Buy </button></td>
</tr>
<tr id="tomato" style="display: none;">
<td class="border"> Tomato Sauce </td>
<td class="border"> Price: 1000000 </td>
<td class="border"> Increases production +1% </td>
<td class="border"><img src="imgaes/transparentPizza.png" height="25px" width="25px"> Price: 1000000 </td>
<td class="border"> Increases production +1% - <i> "The essentials" </i> </td>
<td><button style="cursor: pointer;" onmousedown="playButtonSound()" id="tomatoButton" onclick="tomatoAdder()"> Buy </button></td>
</tr>
</table>
Expand All @@ -132,6 +139,7 @@ <h1 style="text-align: center;"> Pizza Clicker </h1>
<button style="margin-bottom: 25px; cursor: pointer;" onmousedown="playButtonSound()" onclick="green()"> Green </button><br>
<button style="margin-bottom: 25px; cursor: pointer;" onmousedown="playButtonSound()" onclick="yellow()"> Yellow </button><br>
<button style="margin-bottom: 25px; cursor: pointer;" onmousedown="playButtonSound()" onclick="blue()"> Blue </button><br>
<button style="margin-bottom: 25px; cursor: pointer;" onmousedown="playButtonSound()" onclick="purple()"> Purple </button><br>

</div>
</div>
Expand Down
161 changes: 114 additions & 47 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,37 @@ var chefsCPS = 0;
var totalCPS = 0;
var tomatoCPS = 0;

// Upgrades Enabled - 2
// Upgrades Enabled - 3
var tomatoSauce = false;
var graduateCookers = false;
var hotCookers = false;

// Building Prices - 3
var clickersPrice = 15;
var ovensPrice = 100;
var chefsPrice = 1100;


// Unlock Checkers - 4
// Unlock Checkers - 5
var graduateEnabled = false;
var hotEnabled = false;
var tomatoEnabled = false;
var ovensEnabled = false;
var chefsEnabled = false;

var restaurantName = "Your";
var restaurantName = "";
window.setInterval(Timer, 1000);

window.onload = defaultName;

function defaultName() {
document.getElementById("name").innerHTML = "Your Restaurant";
}

function customName() {
document.getElementById("name").innerHTML = restaurantName + " Restaurant";
}

function playButtonSound() {
var sound = new Audio();
sound.src = "sounds/button-click.mp3";
Expand Down Expand Up @@ -68,27 +80,40 @@ function pizzaAdder() {
totalCount += mouseCPS;
totalPizzas();
document.getElementById("pizzaCounter").innerHTML = "Pizzas: " + count.toFixed(0);
if (count >= 100) {
if (ovensEnabled == true) {

} else if (count >= 100) {
ovensEnabled = true;
graduateOptionOn = true;
document.getElementById("ovens").style.display = "";
document.getElementById("GPC").style.display = "";
alert("A new building has been unlocked!");
}
if (count >= 1100) {
if (chefsEnabled == true) {

} else if (count >= 1100) {
chefsEnabled = true;
document.getElementById("chefs").style.display = "";
alert("A new building has been unlocked!");
}
if (count >= 1000000) {
if (tomatoEnabled == true) {

} else if (count >= 1000000) {
tomatoEnabled = true;
document.getElementById("tomato").style.display = "";
alert("A new upgrade has been unlocked!");
}
}

function formulas() {
clickerCPS = 0.1 * clickersCount;
if (graduateCookers == true) {
clickerCPS = clickerCPS * 2;
}
if (clickersCount >= 1) {
clickerCPS = 0.1 * clickersCount;
if (graduateCookers == true) {
clickerCPS = clickerCPS * 2;
if (hotCookers == true) {
clickerCPS = clickerCPS * 2;
};
};
};

ovensCPS = 1 * ovensCount;
chefsCPS = 8 * chefsCount;
}
Expand All @@ -104,6 +129,20 @@ function clickersAdder() {
var formula = 15 * Math.pow(1.15, clickersCount);
clickersPrice = formula;
document.getElementById("clickersPrice").innerHTML = "Price: " + clickersPrice.toFixed(0);
if (graduateEnabled == true) {

} else if (clickersCount >= 1) {
graduateEnabled = true;
document.getElementById("GPC").style.display = "";
alert("A new upgrade has been unlocked!");
}
if (hotEnabled == true) {

} else if (clickersCount >= 100) {
hotEnabled = true;
document.getElementById("HPC").style.display = "";
alert("A new upgrade has been unlocked!");
}
} else {
alert("You don't have enough pizzas for that!");
}
Expand Down Expand Up @@ -144,7 +183,7 @@ function chefsAdder() {

function graduateAdder() {
if (count >= 100) {
graduateEnabled = true;
graduateCookers = true;
mouseCPS = mouseCPS * 2;
count = count - 100;
document.getElementById("pizzaCounter").innerHTML = "Pizzas: " + count.toFixed(0);
Expand All @@ -154,6 +193,18 @@ function graduateAdder() {
}
}

function hotAdder() {
if (count >= 10000) {
hotCookers = true;
mouseCPS = mouseCPS * 2;
count = count - 10000;
document.getElementById("pizzaCounter").innerHTML = "Pizzas: " + count.toFixed(0);
formulas();
CPS();
document.getElementById("hotButton").disabled = true;
}
}

function tomatoAdder() {
if (count >= 1000000) {
tomatoSauce = true;
Expand Down Expand Up @@ -225,7 +276,7 @@ function CPS() {
function changeName() {
restaurantName = prompt("Enter restaurant name:");
document.getElementById("name").innerHTML = restaurantName + "'s Restaurant";
if (restaurantName === "Andrej" || restaurantName === "Green") {
if (restaurantName === "Andrej" || restaurantName === "Green" || restaurantName === "GCND" || restaurantName === "Green" || restaurantName === "Ando") {
alert("Hi Ando :3");
}

Expand All @@ -241,6 +292,7 @@ function changeName() {
} else {
document.getElementById("name").innerHTML = "Your Restaurant";
}

}

function orange() {
Expand All @@ -263,38 +315,44 @@ function blue() {
$("hr").css({"border": "10px solid blue", "border-radius": "5px"});
}

function purple() {
$("hr").css({"border": "10px solid purple", "border-radius": "5px"});
}

function save() {

var restaurantName;
var save = {
count: count,
totalCount: totalCount,
clickersCount: clickersCount,
ovensCount: ovensCount,
chefsCount: chefsCount,

mouseCPS: mouseCPS,
clickerCPS: clickerCPS,
ovensCPS: ovensCPS,
chefsCPS: chefsCPS,
totalCPS: totalCPS,
tomatoCPS: tomatoCPS,

tomatoSauce: tomatoSauce,
graduateCookers: graduateCookers,

clickersPrice: clickersPrice,
ovensPrice: ovensPrice,
chefsPrice: chefsPrice,

graduateEnabled: graduateEnabled,
tomatoEnabled: tomatoEnabled,
ovensEnabled: ovensEnabled,
chefsEnabled: chefsEnabled,

restaurantName: restaurantName
}
localStorage.setItem("save", JSON.stringify(save));
var save = {
count: count,
totalCount: totalCount,
clickersCount: clickersCount,
ovensCount: ovensCount,
chefsCount: chefsCount,

mouseCPS: mouseCPS,
clickerCPS: clickerCPS,
ovensCPS: ovensCPS,
chefsCPS: chefsCPS,
totalCPS: totalCPS,
tomatoCPS: tomatoCPS,

tomatoSauce: tomatoSauce,
graduateCookers: graduateCookers,
hotCookers: hotCookers,

clickersPrice: clickersPrice,
ovensPrice: ovensPrice,
chefsPrice: chefsPrice,

graduateEnabled: graduateEnabled,
hotEnabled: hotEnabled,
tomatoEnabled: tomatoEnabled,
ovensEnabled: ovensEnabled,
chefsEnabled: chefsEnabled,

restaurantName: restaurantName
}

localStorage.setItem("save", JSON.stringify(save));
};

function load() {
Expand All @@ -315,22 +373,24 @@ function load() {

tomatoSauce = load.tomatoSauce;
graduateCookers = load.graduateCookers;
hotCookers = load.hotCookers;

clickersPrice = load.clickersPrice;
ovensPrice = load.ovensPrice;
chefsPrice = load.chefsPrice;

graduateEnabled = load.graduateEnabled;
hotEnabled = load.hotEnabled;
tomatoEnabled = load.tomatoEnabled;
ovensEnabled = load.ovensEnabled;
chefsEnabled = load.chefsEnabled;

restaurantName = load.restaurantName;

if (restaurantName === Your) {
document.getElementById("name").innerHTML = "Your Restaurant";
if (restaurantName) {
customName();
} else {
document.getElementById("name").innerHTML = restaurantName + "'s Restaurant";
defaultName();
}

document.getElementById("cps").innerHTML = "Clicks Per Second: " + totalCPS.toFixed(2);
Expand All @@ -344,6 +404,9 @@ function load() {
if (graduateEnabled == true) {
document.getElementById("GPC").style.display = "";
}
if (hotEnabled == true) {
document.getElementById("HPC").style.display = "";
}
if (tomatoEnabled == true) {
document.getElementById("tomato").style.display = "";
}
Expand All @@ -360,6 +423,10 @@ function load() {
document.getElementById("graduateButton").disabled = true;
}

if (hotCookers == true) {
document.getElementById("hotButton").disabled = true;
}

if (tomatoSauce == true) {
document.getElementById("tomatoButton").disabled = true;
document.getElementById("TSImage").style.display = "block";
Expand Down

0 comments on commit 9d92358

Please sign in to comment.