im pretty sure this is a bit too over the top as i know there has to be something to shorten it as i will have to repeat this for each item, this will be a massive line waste
if (mouseIsOver(gogglesBtnP1) && mouseWentDown("leftButton") && itemsP1[0] == "" && eggbucksP1 >= 500) {
setTimeout(function() {
itemsP1[0] = "goggles";
}, 50);
eggbucksP1 -= 500;
}
if (mouseIsOver(gogglesBtnP1) && mouseWentDown("leftButton") && itemsP1[0] == "goggles") {
setTimeout(function() {
itemsP1[0] = "gogglesEquipped";
}, 50);
}
if (mouseIsOver(gogglesBtnP1) && mouseWentDown("leftButton") && itemsP1[0] == "gogglesEquipped") {
setTimeout(function() {
itemsP1[0] = "goggles";
}, 50);
}
if (itemsP1[0] == "") {
text("Buy", 48, 94);
}
if (itemsP1[0] == "goggles") {
gogglesBtnP1.setAnimation("equipBtn");
text("Equip", 42, 94);
}
if (itemsP1[0] == "gogglesEquipped") {
gogglesBtnP1.setAnimation("equipBtn");
textSize(12);
text("Unequip", 37, 93);
}