function displayHud()
{
   // show gui
   gui_hud.loadLevel("game/data/levels/common/gui_hud.t2d");
   gui_status.loadLevel("game/data/levels/common/gui_status.t2d");
}

function undisplayHud()
{
   // hide gui
   gui_hud.endLevel();
   gui_status.endLevel();
}

function updateHud()
{
   // update resource indicators
   for(%i = 1; %i <= 6; %i++)
   {     
      if(gameInstance.getHumanPlayer().getResource() == 0)   
      {
         if(gameInstance.getHumanPlayer() $= "playerOne")
            (hud_resource_indicator @ %i).setBlendColor($pref::Game::PlayerOneColor);
         else
            (hud_resource_indicator @ %i).setBlendColor($pref::Game::PlayerTwoColor);
      }
      else if(gameInstance.getHumanPlayer().getResource() >= %i)
      {
         if(gameInstance.getHumanPlayer() $= "playerOne")
            (hud_resource_indicator @ %i).setBlendColor($pref::Game::PlayerOneColor);
         else
            (hud_resource_indicator @ %i).setBlendColor($pref::Game::PlayerTwoColor);
      }
      else
         (hud_resource_indicator @ %i).setBlendColor($pref::Game::NeutralColor);
   }
         
   // update action counter
   hud_action_counter.setFrame(gameInstance.getHumanPlayer().getActions());
}