Ver código fonte

Add news based on food production.

This commit also adds a template for such news and makes
news item pop up more frequently
tags/v0.0.7
Fen Dweller 5 anos atrás
pai
commit
0c802b3ae7
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados ID da chave GPG: E80B35A6F11C3656
3 arquivos alterados com 49 adições e 28 exclusões
  1. +45
    -24
      constants.js
  2. +2
    -2
      gorge.css
  3. +2
    -2
      gorge.js

+ 45
- 24
constants.js Ver arquivo

@@ -308,8 +308,10 @@ function createTemplateUpgrades() {
createClickVictimUpgrades();
createPowerupFreqUpgrades();
createFreeBuildingPowerups();
createNews();
deepFreeze(upgrades);
deepFreeze(powerups);
deepFreeze(news);
}

const prodUpgradeCounts = [1, 5, 10, 25, 50, 75, 100];
@@ -1176,33 +1178,52 @@ const news = [
state => "This is also news.",
state => "SPORTS!"
]
},
{
condition: state => {
return state.resources.food > 100;
},
lines: [
state => "You have at least 100 food. Wow!"
]
},
{
condition: state => {
return state.currentProductivity.food > 100;
},
lines: [
state => "You're eating more than 100 food per second. Wow!"
]
},
{
condition: state => {
return state.belongings.micro.count >= 50;
},
lines: [
state => "You have at least 50 micros. Wow!"
]
}
]

function createNews() {
createNewsFoodAmount();
createNewsFoodRate();
createNewsBuildingCount();
}

function createNewsFoodAmount() {

}

function createNewsFoodRate() {
let counter = 0;
for (let set of newsFoodRateText) {
const factor = counter;
news.push({
condition: state => {
return state.currentProductivity.food >= 5*Math.pow(10, factor) &&
state.currentProductivity.food < 5*Math.pow(10, (factor+1))
},
lines: set
});
counter += 1;
};
}

function createNewsBuildingCount() {

}

const newsFoodRateText = [
[
state => "Your neighbors are complaining about the noise",
state => "You are a very hungry caterpillar"
],
[
state => "You ate your neighbors",
state => "Your former neighbors' neighbors are complaining about the noise"
],
[
state => "You no longer have any neighbors"
]
]

const powerups = {
"instant-food": {
name: "Free Food",


+ 2
- 2
gorge.css Ver arquivo

@@ -527,10 +527,10 @@ div::-webkit-scrollbar-corner {
pointer-events: none;
text-align: center;
position: fixed;
top: 90vh;
top: 98vh;
left: 50vw;
transform-origin: 0% 0%;
animation: news-text-frames 10s cubic-bezier(0.68, -0.55, 0.265, 1.55);
animation: news-text-frames 5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
animation-fill-mode: both;
font-size: 24px;
}


+ 2
- 2
gorge.js Ver arquivo

@@ -971,7 +971,7 @@ function doNews() {

setTimeout(() => {
doNews();
}, 15000 + Math.random() * 2500);
}, 6000);
}

function showNews(text) {
@@ -986,7 +986,7 @@ function showNews(text) {

setTimeout(() => {
body.removeChild(div);
}, 10000);
}, 6000);
}

function doPowerup() {


Carregando…
Cancelar
Salvar