// ****************************************************************************
//
// Logic 71: Night Sargasso
//
// ****************************************************************************

#include "defines.txt"

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


// Check what room the player came from and position them on the
// screen accordingly here, e.g:
 if (prev_room_no == 68) {
   universe=10;
   position.v(ego,new_ego_x,universe);
 }

    animate.obj(o1); //sharks
  animate.obj(o2);
  animate.obj(o3);
  load.view(119);
  set.view(o1,119);
  set.view(o2,119);
  set.view(o3,119);
  position(o1,17,154);
  position(o2,29,112);
  position(o3,80,58);
  ignore.objs(o1);
  ignore.objs(o2);
  ignore.objs(o3);
  draw(o1);
  draw(o2);
  draw(o3);
  wander(o1);
  wander(o2);
  wander(o3);

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


  load.view(117);
  set.view(ego,117);
  draw(ego);
  show.pic();
}

distance(o1, ego, range); //how close is ego to shark
distance(o2, ego, temp_y2);
distance(o3, ego, temp_y3);


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

if ((range<=5 ||     //Eaten by sharks?
     temp_y2<=5 ||
     temp_y3<=5)) {
    print("You have been torn to pieces by sharks.");
    new.room(204);
    }


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

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


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

call(201);

return();