Next we have to write the arrow_clicked function but there's a catch!
There is no way for the function to "know" which scene it is on!
I solved this by creating a global variable g_scene which is given its value in set_scene.

arrow_clicked function
function arrow_clicked(image) {
  var id=image.id;
  if (id=='up') var n=0;
  if (id=='right') var n=1;
  if (id=='down') var n=2;
  if (id=='left') var n=3;
  var urdl=g_layout[g_scene];
  var new_scene=urdl[n];
  set_scene(new_scene);
}

In all your testing did you observe that there was no way to reach scene 17? This is because g_layout[9]=[0,8,0,0] which means there is no up arrow.

This is deliberate because the player has to open the door first.
We add another global variable, g_door which is set to true to indicate the door is showing. See how far you can get before reading on.