Kaynağa Gözat

Added background color control.

tags/v0.1.0
Fen Dweller 6 yıl önce
ebeveyn
işleme
4d1208af7d
3 değiştirilmiş dosya ile 16 ekleme ve 2 silme
  1. +5
    -2
      game.js
  2. +8
    -0
      satiate.js
  3. +3
    -0
      stories/fen-snack.js

+ 5
- 2
game.js Dosyayı Görüntüle

@@ -93,11 +93,14 @@ function stopClassTimers(timerClass, state, inverse) {
matches.forEach(timer => clearTimeout(timer.timeout));
state.timers = others;
}


}

function stopAllTimers(state) {
state.timers.forEach(x => clearTimeout(x.timeout));
state.timers = [];
}

function setBackgroundColor(r, g, b) {
document.querySelector(".scene").style["background-color"] = "rgb(" + r + "," + g + "," + b + ")";

}

+ 8
- 0
satiate.js Dosyayı Görüntüle

@@ -7,6 +7,8 @@ const version = "pre-alpha";

let state;

let refreshHook;

function print(lines) {
(lines.concat([newline])).forEach(line => {
const log = document.querySelector("#log");
@@ -24,6 +26,10 @@ function refresh() {
updateRoom(state);
updateWorldInfo(state);
updatePlayerInfo(state);

if (refreshHook) {
refreshHook(state)
}
}

function switchModal(to) {
@@ -77,6 +83,8 @@ function init(story) {

story.intro.setup(state);

refreshHook = story.refresh;

goToRoom(story.intro.start, state);
}



+ 3
- 0
stories/fen-snack.js Dosyayı Görüntüle

@@ -29,6 +29,9 @@ stories.push({
}, state);
}
},
refresh: state => {
setBackgroundColor(50 - state.player.stats.health/2, 0, 0)
},
world: {
stomach: {
id: "stomach",


Yükleniyor…
İptal
Kaydet