// ****************************************************************************
//
// Logic 17: Walking through the waterfall
//
// ****************************************************************************

#include "defines.txt"

if (new_room) {
  if (done_flag) {
  load.pic(room_no);
  draw.pic(room_no);
  discard.pic(room_no);
  }
  else {
  universe=107;
  load.pic(universe);
  draw.pic(universe);
  discard.pic(universe);
  }

  set.horizon(37);

  if (prev_room_no == 19) {
      position(ego,3,108);
      set(done_flag);
      }
  if ((prev_room_no == 16 ||
       prev_room_no == 18)){
       set(done_flag);
       }

  timer1_a = 0;

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

if (said("look")) {
  if (new_ego_x < 108 &&
      new_ego_x > 43) {
         print("It appears that the water has worn a little cave into the north face of the cliff.");
         }
  else {
         print("The waterfall rushes down from the heights below.");
      }
  }

if (said("look","waterfall")) {
    print("The shimmering crystal sheet of water pours down the side of the cliff.");
    }

if ((said("look","cliff") ||
     said("look","wall"))) {
    print("The water seems to be chewing into the wall.");
    }

if (said("look","rock")) {
    print("These rocks look uncannily like tusks.");
    }

if (timer1_a==10) {//Waterfall animation
    toggle(done_flag);
    new.room(17);
    }
else {
    timer1_a++;
    }

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

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

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

return();