소스 검색

Give each powerup an icon; add a second powerup

tags/v0.0.4
Fen Dweller 6 년 전
부모
커밋
e5f8743a2b
2개의 변경된 파일18개의 추가작업 그리고 6개의 파일을 삭제
  1. +11
    -0
      constants.js
  2. +7
    -6
      gorge.js

+ 11
- 0
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]);
}
}
}

+ 7
- 6
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);


불러오는 중...
취소
저장