fungi-renderer.js
/*
  Updating gold & time - 'score' - counters comes with a simple animation.
  As above, the renderer compares the actual data received from the game
  and the data that is currently displayed and acts accordingly.
  Updating gold counter is more complex as it involves (1) two animations - one
  for a gain and one for a loss of gold - and (2) visual indicator of
  a negative gold value.
  */
Updating gold & time - 'score' - counters comes with a simple animation.
As above, the renderer compares the actual data received from the game
and the data that is currently displayed and acts accordingly.
Updating gold counter is more complex as it involves (1) two animations - one
for a gain and one for a loss of gold - and (2) visual indicator of
a negative gold value.
Updating gold & time - ' score ' - counters comes with a simple animation . As above the renderer compares the actual data received from the game and the data that is currently displayed and acts accordingly . Updating gold counter is more complex as it involves ( 1 ) two animations - one for a gain and one for a loss of gold - and ( 2 ) visual indicator of a negative gold value .
updateGoldCounter () {
    let currentGold = this.goldCounterDOMElement.textContent
    let newGold = this.game.gold
    let goldCounterIcon = this.goldCounterDOMElement.previousElementSibling
    if (newGold > currentGold) {
      goldCounterIcon.classList.add('popout')
      setTimeout(function() {
        goldCounterIcon.classList.remove('popout')
      }, Renderer.animationTimes.buttonAction)
    }
    else {
      goldCounterIcon.classList.add('popdown')
      setTimeout(function() {
        goldCounterIcon.classList.remove('popdown')
      }, Renderer.animationTimes.buttonAction)
    }
    this.goldCounterDOMElement.className = newGold < 0 ? 'negative-value' : ''
    this.goldCounterDOMElement.textContent = this.game.gold
  }
updateGoldCounter ( ) { let currentGold = this . goldCounterDOMElement . textContent let newGold = this . game . gold let goldCounterIcon = this . goldCounterDOMElement . previousElementSibling if ( newGold > currentGold ) { goldCounterIcon . classList . add ( 'popout' ) setTimeout ( function ( ) { goldCounterIcon . classList . remove ( 'popout' ) } , Renderer . animationTimes . buttonAction ) } else { goldCounterIcon . classList . add ( 'popdown' ) setTimeout ( function ( ) { goldCounterIcon . classList . remove ( 'popdown' ) } , Renderer . animationTimes . buttonAction ) } this . goldCounterDOMElement . className = newGold < 0 ? 'negative-value' : '' this . goldCounterDOMElement . textContent = this . game . gold }
Updating gold & time - 'score' - counters comes with a simple animation.
Updating gold & time - ' score ' - counters comes with a simple animation .