소스 검색

Some more info. Moving triggers a refresh

tags/v0.1.0
Fen Dweller 6 년 전
부모
커밋
b8b9f836ff
No known key found for this signature in database GPG 키 ID: E80B35A6F11C3656
5개의 변경된 파일23개의 추가작업 그리고 7개의 파일을 삭제
  1. +9
    -0
      game.js
  2. +6
    -1
      satiate.css
  3. +4
    -4
      satiate.html
  4. +1
    -0
      satiate.js
  5. +3
    -2
      world.js

+ 9
- 0
game.js 파일 보기

@@ -1,6 +1,9 @@
function initGame(game, state) {
state.info = {};
state.info.time = 60 * 60 * 9;

state.player.stats = {};
state.player.stats.health = 100;
}

// TODO: format string this lol
@@ -24,3 +27,9 @@ function updateWorldInfo(state) {

timeInfo.textContent = "Time: " + renderTime(state.info.time);
}

function updatePlayerInfo(state) {
const health = document.querySelector("#player-info-health");

health.textContent = "Health: " + state.player.stats.health;
}

+ 6
- 1
satiate.css 파일 보기

@@ -42,12 +42,17 @@ html, body {
flex: 5;
}

#self-info {
#player-info {
margin: 10px;
background: #222;
flex: 5;
}

.info-header {
font-size: 36px;
text-align: center;
}

#control-area {
display: flex;
min-height: 40%;


+ 4
- 4
satiate.html 파일 보기

@@ -25,15 +25,15 @@
this is the menu, eventually
</div>
<div id="world-info">
this is world info
<div class="info-header" id="world-info-header">World</div>
<div id="world-info-time">Time to get a watch!</div>
</div>
<div id="self-info">
this is your own info
<div id="player-info">
<div class="info-header" id="player-info-header">Player</div>
<div id="player-info-health"></div>
</div>
</div>
<div id="log">
this is the log
</div>
<div class="sidebar" id="area-info">
<div id="area-name"></div>


+ 1
- 0
satiate.js 파일 보기

@@ -31,6 +31,7 @@ function print(lines) {
function refresh() {
updateRoom(state);
updateWorldInfo(state);
updatePlayerInfo(state);
}

// setup the game


+ 3
- 2
world.js 파일 보기

@@ -57,7 +57,7 @@ function moveToRoom(src, exit, dest, state) {
state.world[dest].move(state.world[dest], state);
state.player.location = dest;

updateRoom(state);
refresh();
}

function goToRoom(dest, state) {
@@ -72,7 +72,8 @@ function goToRoom(dest, state) {
}

state.player.location = dest;
updateRoom(state);
refresh();
}

function updateRoom(state) {


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