// ****************************************************************************
//
// Logic 25: fork inna road
//
// ****************************************************************************

#include "defines.txt"

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


// Check what room the player came from and position them on the
// screen accordingly here, e.g:
 if (prev_room_no == 24) {
   position(ego,71,158);
 }

  animate.obj(o1);  //teleporter
  load.view(23);
  set.view(o1,23);
  position(o1,60,70);
  set.loop(o1,0);
  draw(o1);

  reset(done_flag);

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

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

if ((said("look") ||
     said("look","path"))) {
  print("To the right you smell fresh water and flowers.  To the left you smell decay and corruption.");
  print("In the center is some kind of crazy machine.");
}

if (said("look","machine")) {
         print("Ah, it's a Zom-Co Teleportation machine.");
         print("I wonder where it will transport you.");
         }

if (said("look","handle")) {
    print("This must be the lever to activate the machine.");
    }         

if (said("hit","machine")) {
     print("WARNING:  Tilting, rocking, or striking the machine can cause it to tip over, resulting in possible injury or death.");
     }

if ((said("use","machine") ||
     said("use","handle"))) {
     if (obj.in.box(ego,40,40,90,90)) {
         print("Here we go!");
         ego_dir=0;
         set.loop(o1,1);
         animate.obj(o2);
         load.view(24);
         set.view(o2,24);
         universe=2;
         cycle.time(o2,universe);
         position.v(o2,new_ego_x,new_ego_y);
         erase(ego);
         position(ego,65,112);
         draw(o2);
         end.of.loop(o2,done_flag);
         }
     else {
         print("Get closer, please");
         }
     }

if (done_flag) {
    reset(done_flag);
    new.room(12);
    }

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

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

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

if (sound_flag) {
    sound(9, sound_flag);
    }

return();