// ****************************************************************************
//
// Logic 3: Ego Mouse Control Test Room
//
// ****************************************************************************

#include "defines.txt"

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

  position(ego,120,140);

  draw(ego);
  show.pic();
}

if(mouse_button == mb_left) {
  // If the user clicks on the help icon
  if(mouse_y > 7 && mouse_y < 20 && mouse_x < 12) {
     print("Welcome to the AGI Mouse Ego Controlling Demo.\nLeft click anywhere on the screen, and the ego will walk there just like SCI!");
  } else {
    // If the user clicks on the exit icon
    if(mouse_y > 7 && mouse_y < 20 && mouse_x > 148) {
       new.room(2);
    } else {
      // If the user clicks any other area, walk ego to it
      mouse_y -= 8;
      move.obj.v(ego,mouse_x,mouse_y,2,f255);
    }
  } 
}

return();
