// ****************************************************************************
//
// Logic 2: First room
//
// ****************************************************************************

#include "defines.txt"

if (new_room) {
  load.pic(room_no);
  draw.pic(room_no);
  discard.pic(room_no);
  set.horizon(50);

  status.line.on();

  show.pic();

  load.view(2);
  animate.obj(o2);
  set.view(o2,2);
  ignore.horizon(o2);
  position(o2,56,60);

  set.view(o3,2);
  animate.obj(o3);
  ignore.horizon(o3);
  position(o3,104,96);

  set.view(o4,2);
  animate.obj(o4);
  ignore.horizon(o4);
  position(o4,8,96);

  set.view(o5,2);
  animate.obj(o5);
  ignore.horizon(o5);
  position(o5,56,132);
}

if(mouse_button == mb_left) {
  // If the user clicks on the help icon
  if(mouse_y > 7 && mouse_y < 20 && mouse_x < 12) {
     print(game_about_message);   
  } else {
    // If the user clicks on the exit icon
    if(mouse_y > 7 && mouse_y < 20 && mouse_x > 148) {
      stop.sound();
      quit(0); 
    }
  }
}

// Is mouse in the area of the button?
if(mouse_y > 32 && mouse_y < 68 && mouse_x > 56 && mouse_x < 103) {
  // Is the mouse button pressed
  if(mouse_button == mb_left) {
    // If it is, draw the mouse button down, then jump to room 3
    set.loop(o2,2);
    new.room(3);
  } else {
    // Otherwise, draw the button as a mouse over graphic
    set.loop(o2,1);
  }
} else {
  // Draw the mouse button in normal state
  set.loop(o2,0);
}
draw(o2);


if(mouse_y > 68 && mouse_y < 104 && mouse_x > 104 && mouse_x < 152) {
  if(mouse_button == mb_left) {
    set.loop(o3,5);
    new.room(4);
  } else {
    set.loop(o3,4);
  }
} else {
  set.loop(o3,3);
}
draw(o3);

if(mouse_y > 68 && mouse_y < 104 && mouse_x > 8 && mouse_x < 55) {
  if(mouse_button == mb_left) {
    set.loop(o4,8);
    new.room(5);
  } else {
    set.loop(o4,7);
  }
} else {
  set.loop(o4,6);
}
draw(o4);

if(mouse_y > 104 && mouse_y < 140 && mouse_x > 56 && mouse_x < 103) {
  if(mouse_button == mb_left) {
    set.loop(o5,11);
  } else {
    set.loop(o5,10);
  }
} else {
  set.loop(o5,9);
}
draw(o5);

return();