// set up sprites
let spriteMonster;

function spriteMonsterSetup(xPos, yPos) {
  spriteMonster = createSprite(
    (gameSceneView.width * xPos) / 434,
    (gameSceneView.height * yPos) / 294,
    160,
    160
  );

  // add animations per each movement from spriteMonster
  spriteMonster.scale = 0.4;

  spriteMonster.addAnimation(
    'down',
    'assets/monsterSprite/monsterSprite_down01.png',
    'assets/monsterSprite/monsterSprite_down02.png',
    'assets/monsterSprite/monsterSprite_down03.png',
    'assets/monsterSprite/monsterSprite_down04.png'
  );
  spriteMonster.addAnimation(
    'up',
    'assets/monsterSprite/monsterSprite_up01.png',
    'assets/monsterSprite/monsterSprite_up02.png',
    'assets/monsterSprite/monsterSprite_up03.png',
    'assets/monsterSprite/monsterSprite_up04.png'
  );
}

function spriteMonsterDraw() {
  if (
    spriteMonster.position.x <= gameSceneView.width - 40 &&
    spriteMonster.position.y <= gameSceneView.height - 40
  ) {
    spriteMonster.visible = true;
  } else {
    spriteMonster.visible = false;
  }

  if (didSocialize != true) {
    spriteMonster.attractionPoint(
      0.09,
      spriteBoy.position.x,
      spriteBoy.position.y
    );

    if (spriteMonster.position.y >= gameSceneView.height / 2) {
      spriteMonster.changeAnimation('up');
    } else {
      spriteMonster.changeAnimation('down');
    }
    spriteMonster.maxSpeed = 4;
  }

  if (spriteBoy.overlap(spriteMonster)) {
    spriteBoyDead = true;
    // sceneNum = 6;
    // playMusic(sceneNum);
    // deathSetup();
  }
}
