// ****************************************************************************
//
// Logic 76: Underwater
//
// ****************************************************************************

#include "defines.txt"

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


// Check what room the player came from and position them on the
// screen accordingly here, e.g:
// if (prev_room_no == 5) {
//   position(ego,12,140);
// }
  animate.obj(o1); //shark
  load.view(119);
  set.view(o1,119);
  position(o1,50,106);
  wander(o1);
  ignore.objs(o1);
  draw(o1);

    load.sound(12);
  sound(12, sound_flag);


  draw(ego);
  show.pic();
}
distance(o1,ego,range);

if (said("look")) {
  print("You are deep in the artificial night of these Stygian waters.");
}

 if (range<=5) {  //Eaten by a shark
    print("Aaargh!  You've been eaten!");
    new.room(204);
    }

if (ego_edge_code == horizon_edge) {  // ego touching horizon
  new.room(72);
}

//if (ego_edge_code == right_edge) {    // ego touching right edge of screen
  //new.room(75);
//}

if (ego_edge_code == bottom_edge) {   // ego touching bottom edge of screen
  new.room(80);
}

if (ego_edge_code == left_edge) {     // ego touching left edge of screen
  new.room(75);
}

call (201);

return();