
previous

page 18
next
Check that you have added the arrows correctly in your index.html.
<img src='images/arrows/up.png' id='up' class='item' onClick='arrow_clicked(this);'>
Now we can add code to set_scene.js so that the required arrows are shown.
set_scene.js
function set_scene(n) {
var scene=document.getElementById('scene');
scene.src='images/scenes/'+n+'.jpg';
Hide_class('item');
if (n==17) Show('red');
if (n==15) Show('orange');
if (n==5) {Show('yellow'); Show('rock');}
if (n==16) Show('green');
if (n==3) Show('blue');
if (n==7) Show('indigo');
if (n==6) Show('violet');
if (n==9) Show('door');
var urdl=g_layout[n];
if (urdl[0]>0) Show('up');
if (urdl[1]>0) Show('right');
if (urdl[2]>0) Show('down');
if (urdl[3]>0) Show('left');
}
var scene=document.getElementById('scene');
scene.src='images/scenes/'+n+'.jpg';
Hide_class('item');
if (n==17) Show('red');
if (n==15) Show('orange');
if (n==5) {Show('yellow'); Show('rock');}
if (n==16) Show('green');
if (n==3) Show('blue');
if (n==7) Show('indigo');
if (n==6) Show('violet');
if (n==9) Show('door');
var urdl=g_layout[n];
if (urdl[0]>0) Show('up');
if (urdl[1]>0) Show('right');
if (urdl[2]>0) Show('down');
if (urdl[3]>0) Show('left');
}
Do a bit of testing by changing the script at the bottom of index.html.
previous
next