if(mouseIsOver(gogglesBtnP1) && mouseWentDown("leftButton")) {
switch(itemsP1[0]) {
case "goggles": itemsP1[0] = "gogglesEquipped"; gogglesBtnP1.setAnimation("equipBtn"); break;
case "gogglesEquipped": itemsP1[0] = "goggles"; gogglesBtnP1.setAnimation("equipBtn"); break;
default: if(eggbucksP1 >= 500) { itemsP1[0] = "goggles"; eggbucksP1 -= 500; } break;
}
}
textSize(12);
textAlign(CENTER, CENTER);
// with this addition you should be able to get your text centered right the first time
text((itemsP1[0] === "goggles" ? "Equip": itemsP1[0] === "gogglesEquipped" ? "Unequip": ""), 42, 94);
not sure if you wanted to keep all the original code but i may have removed a few things, you could just add a setTimeout the switch statement if that is important i figured you put those in so it wouldn't trigger the other if statements