v1.4.2


Click Button The Upgrades The Statistics Achievements

Updated:

  • One Click & One Luck achievement removed
  • Listed Id Elements that weren’t used removed
  • Made classes for HTML Elements, Upgrades, & Data Of The Player
  • Variable Type Changed for most values & functions
  • Upgrades Disabled When At Max | More Info, Reference To Issue #6
  • Made CSS Variables For Readability
  • Popups For Achievements
  • Popups Displaying Upgrade Stats

Fixed Bugs:

  • Buying An Upgrade with your Buy: X greater than the Max no longer bugs the upgrade cost, amount, and max out | Reference To Issue #5

Code:

 /* Popup */
.popup {
    padding: 6.6px;
    margin: 8.9em 0 0 0;
    color: rgba(255, 25, 25, 1);
    outline: 2px solid rgba(255, 25, 25, 1);
    width: max-content;
    display: none;
    visibility: hidden;
    position: fixed;
    right: 13px;
    overflow: visible;
    text-align: right;

    animation-name: popup, popout;
    animation-duration: 3s, 2s;
    animation-delay: 0s, 7s;
    animation-timing-function: ease-in-out, ease-in;
}

.upgpopup {
    padding: 6.6px;
    margin: -1.8em 0 0 0;
    color: rgba(255, 25, 25, 1);
    outline: 2px solid rgba(255, 25, 25, 1);
    width: max-content;
    display: none;
    visibility: hidden;
    position: sticky;
    left: 13px;
    overflow: visible;
    text-align: left;

    animation-name: popup;
    animation-duration: 3s;
    animation-delay: 0s;
    animation-timing-function: ease-in-out;
}

/* Disabled Upgrade Style */
.upgrade:disabled, .upgrade:disabled:hover, .upgrade:disabled:active, .upgrade:disabled:focus {
    background-color: hsl(120, 27%, 27%);
    color: black;
}


/* Popup Function */
function popUp(type, text) {
    let main = new Element(document.getElementsByClassName("popup")[0]);

    main.setText(text);
    main.visibleElement();

    if (type === "success") {
        main.setColor("rgba(25, 255, 25, 1)");
    }

    else {
        main.setColor("rgba(255, 25, 25, 1)");
    }

    setTimeout(function() {
        main.invisibleElement();
    }, 8500);
}

function upgradePopUp(upgrade) {
    let main = new Element(document.getElementsByClassName("upgpopup")[0]);
    main.setColor("Yellow");

    let clone = "\nClicks: " + new Intl.NumberFormat("en-us", { notation: "standard", useGrouping: "true", trailingZeroDisplay: "stripIfInteger"}).format(clicks.toString());;
    let amount = buybtn.amount;

    switch (upgrade) {
        case 'clicks' :
            main.setText("Clicks Upgrade: " + clicksU.amount + "/" + clicksU.max + "\nClicks Cost: " + (clicksU.cost * amount) + "\nPossible Buys: " + ((Math.floor(clicks / (clicksU.cost * (clicksU.max - clicksU.amount))) >= clicksU.max) ? clicksU.max - clicksU.amount : Math.floor(clicks / clicksU.cost)) + clone);
        break;

        case 'luck':
            main.setText("Luck: " + luck.amount + "/" + luck.max + "\nLuck Cost: " + (luck.cost * amount) + "\nPossible Buys: " + ((Math.floor(clicks / (luck.cost * (luck.max - luck.amount))) >= luck.max ? luck.max - luck.amount : Math.floor(clicks / luck.cost))) + clone);
        break;

        case 'luckmultiplier':
            main.setText("Luck Multiplier: " + luck_multiplier.amount + "/" + luck_multiplier.max + "\nLuck Multiplier Cost: " + ((luck_multiplier.cost * amount) + "\nPossible Buys: " + ((Math.floor(clicks / (luck_multiplier.cost * (luck_multiplier.max - luck_multiplier.amount))) >= luck_multiplier.max) ? luck_multiplier.max - luck_multiplier.amount : Math.floor(clicks / luck_multiplier.cost))) + clone);
        break;

        case 'autoclickers':
            main.setText("Auto Clickers: " + autoclicker.amount + "/" + autoclicker.max + "\nAuto Clicker Cost: " + (autoclicker.cost * amount) + "\nPossible Buys: " + ((Math.floor(clicks / (autoclicker.cost * (autoclicker.max - autoclicker.amount))) >= autoclicker.max) ? autoclicker.max - autoclicker.amount : Math.floor(clicks / autoclicker.cost)) + clone);
        break;

        case 'bots':
            main.setText("Bots: " + bot.amount + "/" + bot.max + "\nBot Cost: " + (bot.cost * amount) + "\nPossible Buys: " + ((Math.floor(clicks / (bot.cost * (bot.max - bot.amount))) >= bot.max) ? bot.max - bot.amount : Math.floor(clicks / bot.cost )) + clone);
        break;

        case 'macros':
            main.setText("Macros: " + macro.amount + "/" + macro.max + "\nMacro Cost: " + (macro.cost * amount) + "\nPossible Buys: " + ((Math.floor(clicks / (macro.cost * (macro.max - macro.amount))) >= macro.max) ? macro.max - macro.amount : Math.floor(clicks / macro.cost)) + clone);
        break;

        case 'disappear':
            main.invisibleElement();
        break;

        default:
            main.invisibleElement();
        break;
    }

    main.visibleElement();
}

setInterval(function() {
  if (clicksU.amount >= clicksU.max) { document.getElementById("buyclicks").disabled = true; }
  if (luck.amount >= luck.max) { document.getElementById("luck").disabled = true; }
  if (luck_multiplier.amount >= luck_multiplier.max) { document.getElementById("luckmultiplier").disabled = true; }
  if (autoclicker.amount >= autoclicker.max) { document.getElementById("autoclickers").disabled = true; }
  if (bot.amount >= bot.max) { document.getElementById("bots").disabled = true; }
  if (macro.amount >= macro.max) { document.getElementById("macros").disabled = true; }
}, 100)

GitHub Update Log: updatelog.md

Files

v1.4.2 Play in browser
Jun 11, 2022

Get Incremental-v1.4.2

Leave a comment

Log in with itch.io to leave a comment.