js/app.js
// THIS MAKES THE OBJECTS RENDER.
THIS MAKES THE OBJECTS RENDER.
THIS MAKES THE OBJECTS RENDER .
function renderPage(sceneToRender) {
  if (dog.hitPoints <= 0) {
    faintedDog();
  } else {
    savedog();
    while (bodyMain.firstChild) {
      bodyMain.removeChild(bodyMain.firstChild);
    }
    for (var i = 0; i < book.length; i++) {
      if (book[i].sceneNumber === sceneToRender) {
        var pageText = document.createElement('p');
        pageText.id = 'activeText';
        pageText.textContent = book[i].text;
        bodyMain.appendChild(pageText);
        var pageHtml = document.createElement('div');
        pageHtml.id = 'divId';
        pageHtml.innerHTML = book[i].html;
        bodyMain.appendChild(pageHtml);
        dog.scenesVisited.push(book[i].sceneNumber);
        dog.currentScene = book[i].sceneNumber;
        var backgroundImage = document.createElement('img');
        backgroundImage.src = `${book[i].background}`;
        backgroundImage.id = 'backgroundimage';
        bodyMain.appendChild(backgroundImage);
        var pageScroll = document.getElementById('scroll');
        var sceneText1 = document.createElement('li');
        sceneText1.innerHTML = book[i].sceneNumber;
        pageScroll.appendChild(sceneText1);
      }
    }
  }
}
function renderPage ( sceneToRender ) { if ( dog . hitPoints <= 0 ) { faintedDog ( ) ; } else { savedog ( ) ; while ( bodyMain . firstChild ) { bodyMain . removeChild ( bodyMain . firstChild ) ; } for ( var i = 0 ; i < book . length ; i ++ ) { if ( book [ i ] . sceneNumber === sceneToRender ) { var pageText = document . createElement ( 'p' ) ; pageText . id = 'activeText' ; pageText . textContent = book [ i ] . text ; bodyMain . appendChild ( pageText ) ; var pageHtml = document . createElement ( 'div' ) ; pageHtml . id = 'divId' ; pageHtml . innerHTML = book [ i ] . html ; bodyMain . appendChild ( pageHtml ) ; dog . scenesVisited . push ( book [ i ] . sceneNumber ) ; dog . currentScene = book [ i ] . sceneNumber ; var backgroundImage = document . createElement ( 'img' ) ; backgroundImage . src = ` ${ book [ i ] . background } ` ; backgroundImage . id = 'backgroundimage' ; bodyMain . appendChild ( backgroundImage ) ; var pageScroll = document . getElementById ( 'scroll' ) ; var sceneText1 = document . createElement ( 'li' ) ; sceneText1 . innerHTML = book [ i ] . sceneNumber ; pageScroll . appendChild ( sceneText1 ) ; } } } }
THIS MAKES THE OBJECTS RENDER.
THIS MAKES THE OBJECTS RENDER .