// Jason Brillante "Damdoshi"
// Hanged Bunny Studio 2014-2015
//
// Sewer Glue

#include		"SewerGlue.hpp"
#include		"Menu.hpp"

bool			hbs::Menu::Play(uint64_t		delay)
{
  (void)delay;
  if (arriving)
    {
      arriving -= 1;
      return (false);
    }

  if (intro_step == 0)
    {
      if (theme.getStatus() == sf::SoundSource::Stopped)
	theme.play();
      if ((title_pos += 5) >= sg->GetScreenHeight())
	intro_step = 1;
    }
  else if (intro_step == 1)
    {
      if ((title_pos -= 2) <= 5)
	intro_step = 2;
    }
  else if (intro_step == 2)
    {
      if ((title_back += 1) + 1 == title_pos)
	intro_step = 3;
    }
  else if (intro_step < 6)
    intro_step += 1;

  if (intro_step > 1)
    if (sprites[MONSTER].getPosition().x >
	sg->GetScreenWidth() - sprites[MONSTER].getGlobalBounds().width)
      sprites[MONSTER].move(-1, 0);

  if (warping && (warp_animation += 1) >= 9)
    sg->klondike = destination;
  return (false);
}
