diff --git a/constants.js b/constants.js index 2489a3c..4d98c9c 100644 --- a/constants.js +++ b/constants.js @@ -1051,10 +1051,21 @@ const powerups = { "instant-food": { name: "Free Food", description: "Tasty!", + icon: "fa-drumstick-bite", effect: state => state.resources.food += 10000, popup: (self, e) => { clickPopup("GULP!", "gulp", [e.clientX, e.clientY]); clickPopup("+10000 food", "food", [e.clientX, e.clientY]); } + }, + "free-car": { + name: "Free Car", + description: "It's FREE!", + icon: "fa-car", + effect: state => state.belongings.car.count += 1, + popup: (self, e) => { + clickPopup("CAR!", "gulp", [e.clientX, e.clientY]); + clickPopup("+1 car", "food", [e.clientX, e.clientY]); + } } } \ No newline at end of file diff --git a/gorge.js b/gorge.js index 3eddc14..3dda89d 100644 --- a/gorge.js +++ b/gorge.js @@ -698,12 +698,6 @@ function doPowerup() { button.style.setProperty("--lifetime", lifetime/1000 + "s"); button.style.setProperty("--leftpos", left); button.style.setProperty("--toppos", top); - const icon = document.createElement("div"); - - icon.classList.add("fas"); - icon.classList.add("fa-drumstick-bite"); - - button.appendChild(icon); const body = document.querySelector("body"); @@ -718,6 +712,13 @@ function doPowerup() { const choice = Math.floor(Math.random() * choices.length); const powerup = powerups[choices[choice]]; + + const icon = document.createElement("div"); + + icon.classList.add("fas"); + icon.classList.add(powerup.icon); + + button.appendChild(icon); const remove = setTimeout(() => { body.removeChild(button);